summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-10-31 12:11:18 -0400
committerBrad King <brad.king@kitware.com>2022-10-31 12:19:06 -0400
commit183b9a9eca8bdf7684a6c281c677c58f3c0a66fd (patch)
tree88e3880abfdc0c41bacd56634905653ed5cd47dc /Source
parent4d13f472a2ebd09f6f7f3be466e5d000bbeb6908 (diff)
downloadcmake-183b9a9eca8bdf7684a6c281c677c58f3c0a66fd.tar.gz
CMP0141: Fix PCH REUSE_FROM under policy NEW behavior
Under the CMP0141 NEW behavior added by commit 0e96a20478 (MSVC: Add abstraction for debug information format, 2022-08-25, v3.25.0-rc1~142^2~1), the `-Zi` and `-ZI` flags do not appear in `CMAKE_<LANG>_FLAGS_<CONFIG>` anymore. Teach the PCH REUSE_FROM implementation to recognize the `EditAndContinue` and `ProgramDatabase` debug information formats through the policy's new abstraction. Fixes: #24106
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLocalGenerator.cxx22
1 files changed, 16 insertions, 6 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index fc16b26850..fb269b28fe 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2675,12 +2675,22 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_FLAGS_", configUpper));
- bool editAndContinueDebugInfo =
- langFlags.find("/ZI") != std::string::npos ||
- langFlags.find("-ZI") != std::string::npos;
- bool programDatabaseDebugInfo =
- langFlags.find("/Zi") != std::string::npos ||
- langFlags.find("-Zi") != std::string::npos;
+ bool editAndContinueDebugInfo = false;
+ bool programDatabaseDebugInfo = false;
+ if (cm::optional<std::string> msvcDebugInformationFormat =
+ this->GetMSVCDebugFormatName(config, target)) {
+ editAndContinueDebugInfo =
+ *msvcDebugInformationFormat == "EditAndContinue";
+ programDatabaseDebugInfo =
+ *msvcDebugInformationFormat == "ProgramDatabase";
+ } else {
+ editAndContinueDebugInfo =
+ langFlags.find("/ZI") != std::string::npos ||
+ langFlags.find("-ZI") != std::string::npos;
+ programDatabaseDebugInfo =
+ langFlags.find("/Zi") != std::string::npos ||
+ langFlags.find("-Zi") != std::string::npos;
+ }
// MSVC 2008 is producing both .pdb and .idb files with /Zi.
bool msvc2008OrLess =