diff options
author | Brad King <brad.king@kitware.com> | 2020-06-01 11:44:28 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-06-01 11:44:35 (GMT) |
commit | 3020decbffba27a7525211293d40d0411b504d9e (patch) | |
tree | e5362c0b04049f44f6a955cff49804dc99ac4759 /Source | |
parent | b763a5e3257aa6bdda989f67ed2157717a0a583e (diff) | |
parent | 902858367f27e52a3693f8e65573621d9382ac88 (diff) | |
download | CMake-3020decbffba27a7525211293d40d0411b504d9e.zip CMake-3020decbffba27a7525211293d40d0411b504d9e.tar.gz CMake-3020decbffba27a7525211293d40d0411b504d9e.tar.bz2 |
Merge topic 'pch-fix-bad-ClearSourcesCache'
902858367f Merge branch 'backport-3.16-pch-fix-bad-ClearSourcesCache'
fa7b041eca PCH: Fix logic error that incorrectly clears sources during VS generation
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4815
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 18 |
2 files changed, 17 insertions, 3 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 802b613..39224d1 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3859,8 +3859,6 @@ std::string cmGeneratorTarget::GetPchFileObject(const std::string& config, } std::string& filename = inserted.first->second; - this->AddSource(pchSource, true); - auto pchSf = this->Makefile->GetOrCreateSource( pchSource, false, cmSourceFileLocationKind::Known); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 6f73b0c..d388224 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1617,7 +1617,23 @@ bool cmGlobalGenerator::AddAutomaticSources() continue; } lg->AddUnityBuild(gt.get()); - lg->AddPchDependencies(gt.get()); + // Targets that re-use a PCH are handled below. + if (!gt->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM")) { + lg->AddPchDependencies(gt.get()); + } + } + } + for (const auto& lg : this->LocalGenerators) { + for (const auto& gt : lg->GetGeneratorTargets()) { + if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY || + gt->GetType() == cmStateEnums::UTILITY || + gt->GetType() == cmStateEnums::GLOBAL_TARGET) { + continue; + } + // Handle targets that re-use a PCH from an above-handled target. + if (gt->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM")) { + lg->AddPchDependencies(gt.get()); + } } } // The above transformations may have changed the classification of sources. |