summaryrefslogtreecommitdiff
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@gmail.com>2019-09-25 00:08:15 +0200
committerCristian Adam <cristian.adam@gmail.com>2019-10-01 18:33:40 +0200
commite6e189e02bb6e3efafc5d635edf5eb9688291e71 (patch)
tree02a1d57f1c6163db9a9f7e4595a8518b64d1d787 /Source/cmGlobalGenerator.cxx
parentec16afc9e8aed8aebd387c416af5b5eef4ad337a (diff)
downloadcmake-e6e189e02bb6e3efafc5d635edf5eb9688291e71.tar.gz
PCH: Report error when setting COMPILE_PDB_NAME property
Reusable precompile headers require specific COMPILE_PDB_NAME property values. Report error if the user tries to set a different value.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index a75e2edd05..abe483a9d8 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -355,6 +355,42 @@ bool cmGlobalGenerator::CheckTargetsForType() const
return failed;
}
+bool cmGlobalGenerator::CheckTargetsForPchCompilePdb() const
+{
+ if (!this->GetLanguageEnabled("C") && !this->GetLanguageEnabled("CXX")) {
+ return false;
+ }
+ bool failed = false;
+ for (cmLocalGenerator* generator : this->LocalGenerators) {
+ for (cmGeneratorTarget* target : generator->GetGeneratorTargets()) {
+ if (target->GetType() == cmStateEnums::TargetType::GLOBAL_TARGET ||
+ target->GetType() == cmStateEnums::TargetType::INTERFACE_LIBRARY ||
+ target->GetType() == cmStateEnums::TargetType::UTILITY ||
+ cmIsOn(target->GetProperty("ghs_integrity_app"))) {
+ continue;
+ }
+
+ const std::string reuseFrom =
+ target->GetSafeProperty("PRECOMPILE_HEADERS_REUSE_FROM");
+ const std::string compilePdb =
+ target->GetSafeProperty("COMPILE_PDB_NAME");
+
+ if (!reuseFrom.empty() && reuseFrom != compilePdb) {
+ const std::string 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;
+ }
+ }
+ }
+ return failed;
+}
+
bool cmGlobalGenerator::IsExportedTargetsFile(
const std::string& filename) const
{
@@ -1398,6 +1434,10 @@ bool cmGlobalGenerator::Compute()
return false;
}
+ if (this->CheckTargetsForPchCompilePdb()) {
+ return false;
+ }
+
for (cmLocalGenerator* localGen : this->LocalGenerators) {
localGen->ComputeHomeRelativeOutputPath();
}