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:
dt
2010-01-12 13:13:22 +01:00
parent 8b3350286e
commit 60c8686ed8
5 changed files with 22 additions and 5 deletions

View File

@@ -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);