From d68fc038cccc168ae8f3d03f12c00779876233f0 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 4 Feb 2015 10:18:48 +0100 Subject: [PATCH] QmakeProject: Fix mkspecs dir include path 1) When the compiler is invoked, the mkspecs dir is the very first include path, but the code model got it as the very last (still before the system include paths) include path. 2) We had it twice in the include path list. Change-Id: Ia46b6009359c5799790e6c856113ea133b8212c6 Reviewed-by: Erik Verbruggen --- src/plugins/qmakeprojectmanager/qmakeproject.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index 3e17fbc8362..4f89153302b 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -516,9 +516,6 @@ void QmakeProject::updateCppCodeModel() templatePart->projectDefines += pro->cxxDefines(); // part->headerPaths - foreach (const QString &inc, pro->variableValue(IncludePathVar)) - templatePart->headerPaths += ProjectPart::HeaderPath(inc, ProjectPart::HeaderPath::IncludePath); - if (qtVersion) { foreach (const HeaderPath &header, qtVersion->systemHeaderPathes(k)) { ProjectPart::HeaderPath::Type type = ProjectPart::HeaderPath::IncludePath; @@ -526,6 +523,19 @@ void QmakeProject::updateCppCodeModel() type = ProjectPart::HeaderPath::FrameworkPath; templatePart->headerPaths += ProjectPart::HeaderPath(header.path(), type); } + } + + foreach (const QString &inc, pro->variableValue(IncludePathVar)) { + const auto headerPath + = ProjectPart::HeaderPath(inc, ProjectPart::HeaderPath::IncludePath); + // We've added header paths from qtVersion->systemHeaderPathes() above, + // which also contains the mkspecs dir. However, it's also part of + // the pro->variableValue(IncludePathVar), so check for duplicates. + if (!templatePart->headerPaths.contains(headerPath)) + templatePart->headerPaths += headerPath; + } + + if (qtVersion) { if (!qtVersion->frameworkInstallPath().isEmpty()) { templatePart->headerPaths += ProjectPart::HeaderPath( qtVersion->frameworkInstallPath(),