forked from qt-creator/qt-creator
Add the precompiled headers to the project info
QMake passes those headers directly to gcc, so the user doesn't need to include themselves.
This commit is contained in:
@@ -76,6 +76,7 @@ public:
|
||||
QStringList sourceFiles;
|
||||
QStringList includePaths;
|
||||
QStringList frameworkPaths;
|
||||
QStringList precompiledHeaders;
|
||||
};
|
||||
|
||||
class WorkingCopy
|
||||
|
||||
@@ -938,6 +938,11 @@ void Qt4ProFileNode::update()
|
||||
newVarValues[UiDirVar] = uiDirPaths(reader);
|
||||
newVarValues[MocDirVar] = mocDirPaths(reader);
|
||||
newVarValues[PkgConfigVar] = reader->values(QLatin1String("PKGCONFIG"));
|
||||
newVarValues[PrecompiledHeaderVar] =
|
||||
reader->absoluteFileValues(QLatin1String("PRECOMPILED_HEADER"),
|
||||
m_projectDir,
|
||||
QStringList() << m_projectDir,
|
||||
0);
|
||||
|
||||
if (m_varValues != newVarValues) {
|
||||
m_varValues = newVarValues;
|
||||
|
||||
@@ -97,7 +97,8 @@ enum Qt4Variable {
|
||||
IncludePathVar,
|
||||
UiDirVar,
|
||||
MocDirVar,
|
||||
PkgConfigVar
|
||||
PkgConfigVar,
|
||||
PrecompiledHeaderVar
|
||||
};
|
||||
|
||||
class Qt4PriFileNode;
|
||||
|
||||
@@ -507,6 +507,7 @@ void Qt4Project::updateCodeModel()
|
||||
QByteArray definedMacros = predefinedMacros;
|
||||
QStringList allIncludePaths = predefinedIncludePaths;
|
||||
QStringList allFrameworkPaths = predefinedFrameworkPaths;
|
||||
QStringList allPrecompileHeaders;
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
const QString newQtLibsPath = versionInfo.value(QLatin1String("QT_INSTALL_LIBS"));
|
||||
@@ -529,6 +530,10 @@ void Qt4Project::updateCodeModel()
|
||||
info.includes = predefinedIncludePaths;
|
||||
info.frameworkPaths = predefinedFrameworkPaths;
|
||||
|
||||
info.precompiledHeader = pro->variableValue(PrecompiledHeaderVar);
|
||||
|
||||
allPrecompileHeaders.append(info.precompiledHeader);
|
||||
|
||||
// Add custom defines
|
||||
foreach (const QString def, pro->variableValue(DefinesVar)) {
|
||||
definedMacros += "#define ";
|
||||
@@ -623,10 +628,13 @@ void Qt4Project::updateCodeModel()
|
||||
|
||||
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
||||
|
||||
if (pinfo.defines == predefinedMacros &&
|
||||
pinfo.includePaths == allIncludePaths &&
|
||||
pinfo.frameworkPaths == allFrameworkPaths &&
|
||||
pinfo.sourceFiles == files) {
|
||||
//qDebug()<<"Using precompiled header"<<allPrecompileHeaders;
|
||||
|
||||
if (pinfo.defines == predefinedMacros
|
||||
&& pinfo.includePaths == allIncludePaths
|
||||
&& pinfo.frameworkPaths == allFrameworkPaths
|
||||
&& pinfo.sourceFiles == files
|
||||
&& pinfo.precompiledHeaders == allPrecompileHeaders) {
|
||||
// Nothing to update...
|
||||
} else {
|
||||
if (pinfo.defines != predefinedMacros ||
|
||||
@@ -641,6 +649,7 @@ void Qt4Project::updateCodeModel()
|
||||
pinfo.includePaths = allIncludePaths;
|
||||
pinfo.frameworkPaths = allFrameworkPaths;
|
||||
pinfo.sourceFiles = files;
|
||||
pinfo.precompiledHeaders = allPrecompileHeaders;
|
||||
|
||||
modelmanager->updateProjectInfo(pinfo);
|
||||
modelmanager->updateSourceFiles(pinfo.sourceFiles);
|
||||
|
||||
@@ -82,6 +82,7 @@ namespace Internal {
|
||||
QByteArray defines;
|
||||
QStringList includes;
|
||||
QStringList frameworkPaths;
|
||||
QStringList precompiledHeader;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user