summaryrefslogtreecommitdiffstats
path: root/qmake/generators/makefile.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-01-19 13:49:52 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-01-21 11:10:14 +0100
commitb6191b16d41459ed73cea738dfaf8e25e81ae22b (patch)
tree6ad0952af507bf1ab8df9612023d6e224db8d7e2 /qmake/generators/makefile.cpp
parentb2883a6acc7a8d8372a815cc91dd1a8449f25723 (diff)
parent9087df6bd2dd5198ccf101a237aadee331e51ec3 (diff)
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts: src/corelib/global/global.pri src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.h src/corelib/tools/qdatetime.cpp src/plugins/platforms/xcb/qxcbscreen.h src/plugins/platforms/xcb/qxcbwindow.h src/widgets/dialogs/qcolordialog.cpp src/widgets/dialogs/qcolordialog_p.h tools/configure/configureapp.cpp Change-Id: Ie9d6e9df13e570da0a90a67745a0d05f46c532af
Diffstat (limited to 'qmake/generators/makefile.cpp')
-rw-r--r--qmake/generators/makefile.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 3b807c4ccf..a9f22d8597 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -444,6 +444,25 @@ MakefileGenerator::init()
setSystemIncludes(v["QMAKE_DEFAULT_INCDIRS"]);
+ ProStringList &incs = project->values("INCLUDEPATH");
+ if (!project->isActiveConfig("no_include_pwd")) {
+ if (Option::output_dir != qmake_getpwd()) {
+ // Pretend that the build dir is the source dir for #include purposes,
+ // consistently with the "transparent shadow builds" strategy. This is
+ // also consistent with #include "foo.h" falling back to #include <foo.h>
+ // behavior if it doesn't find the file in the source dir.
+ incs.prepend(Option::output_dir);
+ }
+ // This makes #include <foo.h> work if the header lives in the source dir.
+ // The benefit of that is questionable, as generally the user should use the
+ // correct include style, and extra compilers that put stuff in the source dir
+ // should add the dir themselves.
+ // More importantly, it makes #include "foo.h" work with MSVC when shadow-building,
+ // as this compiler looks files up relative to %CD%, not the source file's parent.
+ incs.prepend(qmake_getpwd());
+ }
+ incs.append(project->specDir());
+
const char * const cacheKeys[] = { "_QMAKE_STASH_", "_QMAKE_SUPER_CACHE_", 0 };
for (int i = 0; cacheKeys[i]; ++i) {
if (v[cacheKeys[i]].isEmpty())
@@ -793,12 +812,6 @@ MakefileGenerator::init()
ProStringList incDirs = v["DEPENDPATH"] + v["QMAKE_ABSOLUTE_SOURCE_PATH"];
if(project->isActiveConfig("depend_includepath"))
incDirs += v["INCLUDEPATH"];
- if(!project->isActiveConfig("no_include_pwd")) {
- QString pwd = qmake_getpwd();
- if(pwd.isEmpty())
- pwd = ".";
- incDirs += pwd;
- }
QList<QMakeLocalFileName> deplist;
for (ProStringList::Iterator it = incDirs.begin(); it != incDirs.end(); ++it)
deplist.append(QMakeLocalFileName(unescapeFilePath((*it).toQString())));
@@ -850,11 +863,6 @@ MakefileGenerator::init()
(*it) = Option::fixPathToLocalOS((*it).toQString());
}
- if(!project->isActiveConfig("no_include_pwd")) { //get the output_dir into the pwd
- if(Option::output_dir != qmake_getpwd())
- project->values("INCLUDEPATH").append(".");
- }
-
//fix up the target deps
static const char * const fixpaths[] = { "PRE_TARGETDEPS", "POST_TARGETDEPS", 0 };
for (int path = 0; fixpaths[path]; path++) {