QmakeProjectManager: Try harder to find include paths in sysroot

As opposed to qmake itself, Qt Creator tries to resolve the value of
INCLUDEPATH against the sysroot. Therefore we should not reject Unix-
type absolute paths as candidates for sysrootification on Windows hosts.

Fixes: QTCREATORBUG-21164
Change-Id: If4be103061ad3edc64f8d1f5cfeb7c6b48e961c8
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Christian Kandeler
2019-08-12 15:29:33 +02:00
parent 65f2f8a2b4
commit 6c40fec9b0

View File

@@ -1785,11 +1785,30 @@ QStringList QmakeProFile::includePaths(QtSupport::ProFileReader *reader, const F
} }
} }
bool tryUnfixified = false;
foreach (const ProFileEvaluator::SourceFile &el, foreach (const ProFileEvaluator::SourceFile &el,
reader->fixifiedValues(QLatin1String("INCLUDEPATH"), projectDir, buildDir.toString(), reader->fixifiedValues(QLatin1String("INCLUDEPATH"), projectDir, buildDir.toString(),
false)) { false)) {
paths << sysrootify(el.fileName, sysroot.toString(), projectDir, buildDir.toString()); const QString sysrootifiedPath = sysrootify(el.fileName, sysroot.toString(), projectDir,
buildDir.toString());
if (IoUtils::exists(sysrootifiedPath))
paths << sysrootifiedPath;
else
tryUnfixified = true;
} }
// If sysrootifying a fixified path does not yield a valid path, try again with the
// unfixified value. This can be necessary for cross-building; see QTCREATORBUG-21164.
if (tryUnfixified) {
const QStringList rawValues = reader->values("INCLUDEPATH");
for (const QString &p : rawValues) {
const QString sysrootifiedPath = sysrootify(QDir::cleanPath(p), sysroot.toString(),
projectDir, buildDir.toString());
if (IoUtils::exists(sysrootifiedPath))
paths << sysrootifiedPath;
}
}
// paths already contains moc dir and ui dir, due to corrrectly parsing uic.prf and moc.prf // paths already contains moc dir and ui dir, due to corrrectly parsing uic.prf and moc.prf
// except if those directories don't exist at the time of parsing // except if those directories don't exist at the time of parsing
// thus we add those directories manually (without checking for existence) // thus we add those directories manually (without checking for existence)