summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-06-01 11:44:28 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-06-01 11:44:34 (GMT)
commitf67137273588b95277d48500ca900213a6a9429c (patch)
tree4c2f86b94e905a60c4451ac0451ced160845ce7d /Source
parent70b8a2863f59ef36b2c10ccd616e119ae5522fe5 (diff)
parent902858367f27e52a3693f8e65573621d9382ac88 (diff)
downloadCMake-f67137273588b95277d48500ca900213a6a9429c.zip
CMake-f67137273588b95277d48500ca900213a6a9429c.tar.gz
CMake-f67137273588b95277d48500ca900213a6a9429c.tar.bz2
Merge topic 'pch-fix-bad-ClearSourcesCache' into release-3.17
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.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx18
2 files changed, 17 insertions, 3 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index b4b0c45..36cf213 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3556,8 +3556,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 6a2d4c7..238097d 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1609,7 +1609,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.