forked from qt-creator/qt-creator
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:
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user