summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-10-02 11:48:45 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-10-02 11:48:55 (GMT)
commit9649c91f830a6fad5c2f84b90f34af10c2edfa15 (patch)
tree0c4ec155a2b3302fddeab4ca4ef244d31b72cdf0 /Source
parent20e9151e6cf47299bb99d85446beb5dc656dba7e (diff)
parente6e189e02bb6e3efafc5d635edf5eb9688291e71 (diff)
downloadCMake-9649c91f830a6fad5c2f84b90f34af10c2edfa15.zip
CMake-9649c91f830a6fad5c2f84b90f34af10c2edfa15.tar.gz
CMake-9649c91f830a6fad5c2f84b90f34af10c2edfa15.tar.bz2
Merge topic 'pch-compile-pdb'
e6e189e02b PCH: Report error when setting COMPILE_PDB_NAME property Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3864
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx40
-rw-r--r--Source/cmGlobalGenerator.h1
2 files changed, 41 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();
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index cf9c951..eb5ee27 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -610,6 +610,7 @@ private:
bool CheckTargetsForMissingSources() const;
bool CheckTargetsForType() const;
+ bool CheckTargetsForPchCompilePdb() const;
void CreateLocalGenerators();