summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/PrecompileHeaders
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-11-15 11:29:53 (GMT)
committerBrad King <brad.king@kitware.com>2022-11-15 11:57:02 (GMT)
commit94164ea55e3a24274088afd23ad9018aa04b1c50 (patch)
tree74f1b42b85d8bbec7a00764e2c75f4b6b643d89e /Tests/RunCMake/PrecompileHeaders
parent3555265f1df989bbb2bbd8ca408efcb3cb0cfd69 (diff)
downloadCMake-94164ea55e3a24274088afd23ad9018aa04b1c50.zip
CMake-94164ea55e3a24274088afd23ad9018aa04b1c50.tar.gz
CMake-94164ea55e3a24274088afd23ad9018aa04b1c50.tar.bz2
CMP0141: Fix PCH REUSE_FROM when MSVC_DEBUG_INFORMATION_FORMAT is empty
Under the policy's NEW behavior, `[CMAKE_]MSVC_DEBUG_INFORMATION_FORMAT` may be explicitly set to an empty string to tell CMake not to add any flags for this abstraction. In this case, fall back to checking the language-wide flags as we do in the OLD behavior. This revises commit 183b9a9eca (CMP0141: Fix PCH REUSE_FROM under policy NEW behavior, 2022-10-31, v3.25.0-rc3~4^2). Issue: #24106
Diffstat (limited to 'Tests/RunCMake/PrecompileHeaders')
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchReuseFrom-CMP0141-NEW-empty.cmake4
-rw-r--r--Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake3
2 files changed, 7 insertions, 0 deletions
diff --git a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom-CMP0141-NEW-empty.cmake b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom-CMP0141-NEW-empty.cmake
new file mode 100644
index 0000000..41c7d22
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom-CMP0141-NEW-empty.cmake
@@ -0,0 +1,4 @@
+cmake_policy(SET CMP0141 NEW)
+set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "")
+string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " -Zi")
+include(PchReuseFrom-common.cmake)
diff --git a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
index 687fc0e..b163369 100644
--- a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
@@ -17,6 +17,9 @@ run_test(SkipPrecompileHeaders)
run_test(CXXnotC)
run_test(PchReuseFrom-CMP0141-OLD)
run_test(PchReuseFrom-CMP0141-NEW)
+if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
+ run_test(PchReuseFrom-CMP0141-NEW-empty)
+endif()
run_test(PchReuseFromPrefixed)
run_test(PchReuseFromSubdir)
run_cmake(PchMultilanguage)