Add includes to the codemodel specified via PKGCONFIG in .pro files

We run pkg-config --cflags-only-I $$PKGCONFIG in the background to find
those includes.

Task-Nr: 250195
This commit is contained in:
dt
2009-05-13 18:09:47 +02:00
parent 5321950d40
commit 286325ceb6
3 changed files with 18 additions and 2 deletions

View File

@@ -527,13 +527,27 @@ void Qt4Project::updateCodeModel()
}
const QStringList proIncludePaths = pro->variableValue(IncludePathVar);
foreach (QString includePath, proIncludePaths) {
foreach (const QString &includePath, proIncludePaths) {
if (!allIncludePaths.contains(includePath))
allIncludePaths.append(includePath);
if (!info.includes.contains(includePath))
info.includes.append(includePath);
}
{ // Pkg Config support
QStringList pkgConfig = pro->variableValue(PkgConfigVar);
if (!pkgConfig.isEmpty()) {
pkgConfig.prepend("--cflags-only-I");
QProcess process;
process.start("pkg-config", pkgConfig);
process.waitForFinished();
QString result = process.readAllStandardOutput();
foreach(const QString &part, result.trimmed().split(' ', QString::SkipEmptyParts)) {
info.includes.append(part.mid(2)); // Chop off "-I"
}
}
}
// Add mkspec directory
info.includes.append(qtVersion(activeBuildConfiguration())->mkspecPath());