|
|
@@ -387,38 +387,15 @@ bool cmGlobalGenerator::CheckTargetsForType() const
|
|
|
return failed;
|
|
|
}
|
|
|
|
|
|
-bool cmGlobalGenerator::CheckTargetsForPchCompilePdb() const
|
|
|
+void cmGlobalGenerator::MarkTargetsForPchReuse() const
|
|
|
{
|
|
|
- if (!this->GetLanguageEnabled("C") && !this->GetLanguageEnabled("CXX")) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- bool failed = false;
|
|
|
for (auto const& generator : this->LocalGenerators) {
|
|
|
for (auto const& target : generator->GetGeneratorTargets()) {
|
|
|
- if (!target->CanCompileSources() ||
|
|
|
- target->GetProperty("ghs_integrity_app").IsOn()) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- std::string const& reuseFrom =
|
|
|
- target->GetSafeProperty("PRECOMPILE_HEADERS_REUSE_FROM");
|
|
|
- std::string const& compilePdb =
|
|
|
- target->GetSafeProperty("COMPILE_PDB_NAME");
|
|
|
-
|
|
|
- if (!reuseFrom.empty() && reuseFrom != compilePdb) {
|
|
|
- std::string const e = cmStrCat(
|
|
|
- "PRECOMPILE_HEADERS_REUSE_FROM property is set on target (\"",
|
|
|
- target->GetName(),
|
|
|
- "\"). Reusable precompile headers requires the COMPILE_PDB_NAME"
|
|
|
- " property to have the value \"",
|
|
|
- reuseFrom, "\"\n");
|
|
|
- this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e,
|
|
|
- target->GetBacktrace());
|
|
|
- failed = true;
|
|
|
+ if (auto* reuseTarget = target->GetPchReuseTarget()) {
|
|
|
+ reuseTarget->MarkAsPchReused();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return failed;
|
|
|
}
|
|
|
|
|
|
bool cmGlobalGenerator::IsExportedTargetsFile(
|
|
|
@@ -1550,6 +1527,8 @@ bool cmGlobalGenerator::Compute()
|
|
|
localGen->AddHelperCommands();
|
|
|
}
|
|
|
|
|
|
+ this->MarkTargetsForPchReuse();
|
|
|
+
|
|
|
// Add automatically generated sources (e.g. unity build).
|
|
|
// Add unity sources after computing compile features. Unity sources do
|
|
|
// not change the set of languages or features, but we need to know them
|
|
|
@@ -1597,10 +1576,6 @@ bool cmGlobalGenerator::Compute()
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if (this->CheckTargetsForPchCompilePdb()) {
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
for (auto const& localGen : this->LocalGenerators) {
|
|
|
localGen->ComputeHomeRelativeOutputPath();
|
|
|
}
|