diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2018-11-22 09:35:38 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2018-11-24 20:12:16 +0000 |
commit | e04aaf188c735b775dc4483099ec61a9372b0fa8 (patch) | |
tree | 509fc5d31bdbf82e8a3a30a88b8a39b2444d337c /qmake/generators/win32/msvc_objectmodel.cpp | |
parent | e5f94f0f0586b2240691f4b17be513b45feac440 (diff) | |
download | qtbase-e04aaf188c735b775dc4483099ec61a9372b0fa8.tar.gz |
Support 'CONFIG += precompile_header_c' in VS projects
The CONFIG value precompile_header_c was ignored in the VS project
generator. Add a member VcprojGenerator::pchIsCFile that is set to
true if precompile_header_c is active.
The code in modifyPCHstage had to be rearranged to separate the three
parts for stable.h, stable.cpp and other files.
Task-number: QTBUG-62821
Change-Id: I340eb165baa22cafcb64815cf223ce9a21aca558
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'qmake/generators/win32/msvc_objectmodel.cpp')
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.cpp | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index b9ecb14888..7caa94c512 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2213,20 +2213,8 @@ void VCFilter::addFiles(const ProStringList& fileList) void VCFilter::modifyPCHstage(QString str) { - bool pchThroughSourceFile = !Project->precompSource.isEmpty(); - bool isCFile = false; - for (QStringList::Iterator it = Option::c_ext.begin(); it != Option::c_ext.end(); ++it) { - if (str.endsWith(*it)) { - isCFile = true; - break; - } - } const bool isHFile = (str == Project->precompH); - bool isCPPFile = pchThroughSourceFile && (str == Project->precompSource); - - if(!isCFile && !isHFile && !isCPPFile) - return; - + const bool pchThroughSourceFile = !Project->precompSource.isEmpty(); if (isHFile && pchThroughSourceFile && Project->autogenPrecompSource) { useCustomBuildTool = true; QString toFile(Project->precompSource); @@ -2259,13 +2247,29 @@ void VCFilter::modifyPCHstage(QString str) } useCompilerTool = true; - // Setup PCH options - CompilerTool.UsePrecompiledHeader = (isCFile ? pchNone : pchCreateUsingSpecific); - if (isCFile) + const bool isPrecompSource = pchThroughSourceFile && (str == Project->precompSource); + if (isPrecompSource) { + CompilerTool.UsePrecompiledHeader = pchCreateUsingSpecific; + if (Project->autogenPrecompSource) + CompilerTool.PrecompiledHeaderThrough = Project->precompHFilename; + CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)"); + return; + } + + bool isCFile = false; + for (QStringList::Iterator it = Option::c_ext.begin(); it != Option::c_ext.end(); ++it) { + if (str.endsWith(*it)) { + isCFile = true; + break; + } + } + + bool pchCompatible = (isCFile == Project->pchIsCFile); + if (!pchCompatible) { + CompilerTool.UsePrecompiledHeader = pchNone; CompilerTool.PrecompiledHeaderThrough = QLatin1String("$(NOINHERIT)"); - else if (Project->autogenPrecompSource) - CompilerTool.PrecompiledHeaderThrough = Project->precompHFilename; - CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)"); + CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)"); + } } VCFilterFile VCFilter::findFile(const QString &filePath, bool *found) const |