summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@gmail.com>2020-03-18 18:21:08 (GMT)
committerCristian Adam <cristian.adam@gmail.com>2020-03-26 13:24:46 (GMT)
commit2ce08e54891054aeba3f273f9970a7fe8fa8b66c (patch)
treedddfaec9accd7f9d5c0d5cfa1a036cd35e162b4f /Source/cmGeneratorTarget.cxx
parent863b0fa2aca3ece98d177f2dbafcad56f7037c8a (diff)
downloadCMake-2ce08e54891054aeba3f273f9970a7fe8fa8b66c.zip
CMake-2ce08e54891054aeba3f273f9970a7fe8fa8b66c.tar.gz
CMake-2ce08e54891054aeba3f273f9970a7fe8fa8b66c.tar.bz2
PCH: add an option to disable `-Winvalid-pch`
Fixes: #20295
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx18
1 files changed, 16 insertions, 2 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index af45893..bcb0ea9 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3781,9 +3781,16 @@ std::string cmGeneratorTarget::GetPchCreateCompileOptions(
if (inserted.second) {
std::string& createOptionList = inserted.first->second;
+ if (this->GetPropertyAsBool("PCH_WARN_INVALID")) {
+ createOptionList = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", language, "_COMPILE_OPTIONS_INVALID_PCH"));
+ }
+
const std::string createOptVar =
cmStrCat("CMAKE_", language, "_COMPILE_OPTIONS_CREATE_PCH");
- createOptionList = this->Makefile->GetSafeDefinition(createOptVar);
+
+ createOptionList = cmStrCat(
+ createOptionList, ";", this->Makefile->GetSafeDefinition(createOptVar));
const std::string pchHeader = this->GetPchHeader(config, language);
const std::string pchFile = this->GetPchFile(config, language);
@@ -3802,9 +3809,16 @@ std::string cmGeneratorTarget::GetPchUseCompileOptions(
if (inserted.second) {
std::string& useOptionList = inserted.first->second;
+ if (this->GetPropertyAsBool("PCH_WARN_INVALID")) {
+ useOptionList = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", language, "_COMPILE_OPTIONS_INVALID_PCH"));
+ }
+
const std::string useOptVar =
cmStrCat("CMAKE_", language, "_COMPILE_OPTIONS_USE_PCH");
- useOptionList = this->Makefile->GetSafeDefinition(useOptVar);
+
+ useOptionList = cmStrCat(useOptionList, ";",
+ this->Makefile->GetSafeDefinition(useOptVar));
const std::string pchHeader = this->GetPchHeader(config, language);
const std::string pchFile = this->GetPchFile(config, language);