From d1528919de343317b82ed52eb62ee3eb3fd8488b Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 28 Apr 2015 14:30:57 +0200 Subject: xcode generator: don't change output_dir when opening a pbx file directly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ProjectBuilderMakefileGenerator::openOutput should only change back Option::output_dir when creating a pbx file inside an Xcode project. Since the pbx file will be placed inside a different directory than output_dir when creating an Xcode project, MakefileGenerator::openOutput() will redirect output_dir to be inside the Xcode project as well. Since we don't want this redirection, we change output_dir back to what it was once the call returns. But we should only do this when creating the whole Xcode project, since only then we create a pbx file that is different from output_dir in the first place. A bug with this is seen when making qt_makeqmake.mak (which is a helper makefile inside the Xcode project). That file will only regenerate the pbx file (and not the whole Xcode project), which means that we don't enter the fileName.isEmpty() section, which means that output_dir should stay as it is. Task-number: QTBUG-45826 Change-Id: I03d5c3dec395ff4768f9272fd1981c6fd35efb1e Reviewed-by: Tor Arne Vestbø --- qmake/generators/mac/pbuilder_pbx.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index fcd6bf8308..d9eb149177 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -1812,11 +1812,14 @@ ProjectBuilderMakefileGenerator::openOutput(QFile &file, const QString &build) c } output += QString("project.pbxproj"); file.setFileName(output); + bool ret = UnixMakefileGenerator::openOutput(file, build); + ((ProjectBuilderMakefileGenerator*)this)->pbx_dir = Option::output_dir.section(Option::dir_sep, 0, -1); + Option::output_dir = pbx_dir.section(Option::dir_sep, 0, -2); + return ret; } - bool ret = UnixMakefileGenerator::openOutput(file, build); - ((ProjectBuilderMakefileGenerator*)this)->pbx_dir = Option::output_dir.section(Option::dir_sep, 0, -1); - Option::output_dir = pbx_dir.section(Option::dir_sep, 0, -2); - return ret; + + ((ProjectBuilderMakefileGenerator*)this)->pbx_dir = Option::output_dir; + return UnixMakefileGenerator::openOutput(file, build); } /* This function is such a hack it is almost pointless, but it -- cgit v1.2.3