Commit 286325ce authored by dt's avatar dt
Browse files

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
parent 5321950d
......@@ -719,6 +719,7 @@ void Qt4ProFileNode::update()
newVarValues[IncludePathVar] = includePaths(reader);
newVarValues[UiDirVar] = uiDirPaths(reader);
newVarValues[MocDirVar] = mocDirPaths(reader);
newVarValues[PkgConfigVar] = reader->values(QLatin1String("PKGCONFIG"));
if (m_varValues != newVarValues) {
m_varValues = newVarValues;
......
......@@ -99,7 +99,8 @@ enum Qt4Variable {
IncludePathVar,
CxxCompilerVar,
UiDirVar,
MocDirVar
MocDirVar,
PkgConfigVar
};
class Qt4PriFileNode;
......
......@@ -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());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment