summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake')
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake31
1 files changed, 31 insertions, 0 deletions
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake
new file mode 100644
index 0000000..8e43a25
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake
@@ -0,0 +1,31 @@
+enable_language(CXX)
+
+cmake_policy(GET CMP0141 cmp0141)
+if(cmp0141 STREQUAL "NEW")
+ if(NOT CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT)
+ message(SEND_ERROR "CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT not set under NEW behavior")
+ endif()
+else()
+ if(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT)
+ message(SEND_ERROR "CMAKE_MSVC_DEBUG_INFORMATION_FORMAT_DEFAULT is set under OLD behavior")
+ endif()
+endif()
+
+if(cmp0141 STREQUAL "NEW")
+ if(CMAKE_CXX_FLAGS_DEBUG MATCHES "[/-]Zi( |$)")
+ message(SEND_ERROR "CMAKE_CXX_FLAGS_DEBUG has -Zi flags under NEW behavior.")
+ endif()
+ if(CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "[/-]Zi( |$)")
+ message(SEND_ERROR "CMAKE_CXX_FLAGS_RELWITHDEBINFO has -Zi flags under NEW behavior.")
+ endif()
+else()
+ if(NOT (CMAKE_CXX_FLAGS_DEBUG MATCHES "[/-]Zi( |$)"))
+ message(SEND_ERROR "CMAKE_CXX_FLAGS_DEBUG does not have -Zi flags under OLD behavior.")
+ endif()
+ if(NOT (CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "[/-]Zi( |$)"))
+ message(SEND_ERROR "CMAKE_CXX_FLAGS_RELWITHDEBINFO does not have -Zi flags under OLD behavior.")
+ endif()
+endif()
+
+set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT BogusValue)
+add_library(foo empty.cxx)