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 <erik.verbruggen@theqtcompany.com>
This commit is contained in:
Nikolai Kosjar
2015-02-04 10:18:48 +01:00
parent e9b94c131c
commit d68fc038cc

View File

@@ -516,9 +516,6 @@ void QmakeProject::updateCppCodeModel()
templatePart->projectDefines += pro->cxxDefines(); templatePart->projectDefines += pro->cxxDefines();
// part->headerPaths // part->headerPaths
foreach (const QString &inc, pro->variableValue(IncludePathVar))
templatePart->headerPaths += ProjectPart::HeaderPath(inc, ProjectPart::HeaderPath::IncludePath);
if (qtVersion) { if (qtVersion) {
foreach (const HeaderPath &header, qtVersion->systemHeaderPathes(k)) { foreach (const HeaderPath &header, qtVersion->systemHeaderPathes(k)) {
ProjectPart::HeaderPath::Type type = ProjectPart::HeaderPath::IncludePath; ProjectPart::HeaderPath::Type type = ProjectPart::HeaderPath::IncludePath;
@@ -526,6 +523,19 @@ void QmakeProject::updateCppCodeModel()
type = ProjectPart::HeaderPath::FrameworkPath; type = ProjectPart::HeaderPath::FrameworkPath;
templatePart->headerPaths += ProjectPart::HeaderPath(header.path(), type); 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()) { if (!qtVersion->frameworkInstallPath().isEmpty()) {
templatePart->headerPaths += ProjectPart::HeaderPath( templatePart->headerPaths += ProjectPart::HeaderPath(
qtVersion->frameworkInstallPath(), qtVersion->frameworkInstallPath(),