diff options
author | Cristian Adam <cristian.adam@gmail.com> | 2019-09-24 22:08:15 (GMT) |
---|---|---|
committer | Cristian Adam <cristian.adam@gmail.com> | 2019-10-01 16:33:40 (GMT) |
commit | e6e189e02bb6e3efafc5d635edf5eb9688291e71 (patch) | |
tree | 02a1d57f1c6163db9a9f7e4595a8518b64d1d787 /Source/cmGlobalGenerator.cxx | |
parent | ec16afc9e8aed8aebd387c416af5b5eef4ad337a (diff) | |
download | CMake-e6e189e02bb6e3efafc5d635edf5eb9688291e71.zip CMake-e6e189e02bb6e3efafc5d635edf5eb9688291e71.tar.gz CMake-e6e189e02bb6e3efafc5d635edf5eb9688291e71.tar.bz2 |
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.cxx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a75e2ed..abe483a9 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(); } |