summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
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 cde91c9..4cf076e 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3496,8 +3496,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 09fb87d..74bcf7b 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1564,7 +1564,23 @@ bool cmGlobalGenerator::AddAutomaticSources()
continue;
}
lg->AddUnityBuild(gt);
- lg->AddPchDependencies(gt);
+ // Targets that re-use a PCH are handled below.
+ if (!gt->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM")) {
+ lg->AddPchDependencies(gt);
+ }
+ }
+ }
+ for (cmLocalGenerator* lg : this->LocalGenerators) {
+ for (cmGeneratorTarget* 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);
+ }
}
}
// The above transformations may have changed the classification of sources.