mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
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
This commit is contained in:
@@ -2675,12 +2675,22 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
|
|||||||
this->Makefile->GetSafeDefinition(
|
this->Makefile->GetSafeDefinition(
|
||||||
cmStrCat("CMAKE_", lang, "_FLAGS_", configUpper));
|
cmStrCat("CMAKE_", lang, "_FLAGS_", configUpper));
|
||||||
|
|
||||||
bool editAndContinueDebugInfo =
|
bool editAndContinueDebugInfo = false;
|
||||||
langFlags.find("/ZI") != std::string::npos ||
|
bool programDatabaseDebugInfo = false;
|
||||||
langFlags.find("-ZI") != std::string::npos;
|
if (cm::optional<std::string> msvcDebugInformationFormat =
|
||||||
bool programDatabaseDebugInfo =
|
this->GetMSVCDebugFormatName(config, target)) {
|
||||||
langFlags.find("/Zi") != std::string::npos ||
|
editAndContinueDebugInfo =
|
||||||
langFlags.find("-Zi") != std::string::npos;
|
*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.
|
// MSVC 2008 is producing both .pdb and .idb files with /Zi.
|
||||||
bool msvc2008OrLess =
|
bool msvc2008OrLess =
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
cmake_policy(SET CMP0141 NEW)
|
||||||
|
include(PchReuseFrom-common.cmake)
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
cmake_policy(SET CMP0141 OLD)
|
||||||
|
include(PchReuseFrom-common.cmake)
|
||||||
@@ -15,7 +15,8 @@ run_test(PchInterface)
|
|||||||
run_cmake(PchPrologueEpilogue)
|
run_cmake(PchPrologueEpilogue)
|
||||||
run_test(SkipPrecompileHeaders)
|
run_test(SkipPrecompileHeaders)
|
||||||
run_test(CXXnotC)
|
run_test(CXXnotC)
|
||||||
run_test(PchReuseFrom)
|
run_test(PchReuseFrom-CMP0141-OLD)
|
||||||
|
run_test(PchReuseFrom-CMP0141-NEW)
|
||||||
run_test(PchReuseFromPrefixed)
|
run_test(PchReuseFromPrefixed)
|
||||||
run_test(PchReuseFromSubdir)
|
run_test(PchReuseFromSubdir)
|
||||||
run_cmake(PchMultilanguage)
|
run_cmake(PchMultilanguage)
|
||||||
|
|||||||
Reference in New Issue
Block a user