summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-09-14 13:21:08 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-09-14 13:21:27 (GMT)
commitc3e68020d61ae306261b4f953947483a960edf32 (patch)
tree49ab480611211dd6ee15714192dd8e29d22cbe7f /Tests
parente457663ac15e138ce7618d2f74c9656665ab139b (diff)
parenta858466aacb046a953367aeb2ee6c456812fc2dd (diff)
downloadCMake-c3e68020d61ae306261b4f953947483a960edf32.zip
CMake-c3e68020d61ae306261b4f953947483a960edf32.tar.gz
CMake-c3e68020d61ae306261b4f953947483a960edf32.tar.bz2
Merge topic 'MsvcDebugInformationFormatAbstraction'
a858466aac MSVC: Add test for debug information format 0e96a20478 MSVC: Add abstraction for debug information format d4c8111da4 Clang/Windows: Clarify name of internal runtime library flags variables Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7606
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt9
-rw-r--r--Tests/MSVCDebugInformationFormat/CMakeLists.txt81
-rw-r--r--Tests/MSVCDebugInformationFormat/override-C.cmake7
-rw-r--r--Tests/MSVCDebugInformationFormat/override-CUDA.cmake6
-rw-r--r--Tests/MSVCDebugInformationFormat/override-CXX.cmake7
-rw-r--r--Tests/MSVCDebugInformationFormat/override-Fortran.cmake4
-rw-r--r--Tests/MSVCDebugInformationFormat/verify.F901
-rw-r--r--Tests/MSVCDebugInformationFormat/verify.c1
-rw-r--r--Tests/MSVCDebugInformationFormat/verify.cu1
-rw-r--r--Tests/MSVCDebugInformationFormat/verify.cxx1
-rw-r--r--Tests/MSVCDebugInformationFormat/verify.h29
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-result.txt1
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-stderr.txt5
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW.cmake2
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NoEffect.cmake4
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-OLD.cmake2
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-WARN.cmake2
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-common.cmake31
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/MSVCDebugInformationFormat/empty.cxx0
-rw-r--r--Tests/RunCMake/VS10Project/DebugInformationFormat-check.cmake46
-rw-r--r--Tests/RunCMake/VS10Project/DebugInformationFormat.cmake24
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake1
25 files changed, 275 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index b6fec4d..abe742e 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2080,6 +2080,15 @@ if(BUILD_TESTING)
if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM")
ADD_TEST_MACRO(PrecompiledHeader foo)
endif()
+
+ set(MSVCDebugInformationFormat_BUILD_OPTIONS -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
+ if(CMAKE_Fortran_COMPILER)
+ list(APPEND MSVCDebugInformationFormat_BUILD_OPTIONS -DCMake_TEST_Fortran=1)
+ endif()
+ ADD_TEST_MACRO(MSVCDebugInformationFormat)
+ set_property(TEST MSVCDebugInformationFormat APPEND
+ PROPERTY LABELS "CUDA")
+
set(MSVCRuntimeLibrary_BUILD_OPTIONS -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
ADD_TEST_MACRO(MSVCRuntimeLibrary)
set_property(TEST MSVCRuntimeLibrary APPEND
diff --git a/Tests/MSVCDebugInformationFormat/CMakeLists.txt b/Tests/MSVCDebugInformationFormat/CMakeLists.txt
new file mode 100644
index 0000000..b09bc6c
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/CMakeLists.txt
@@ -0,0 +1,81 @@
+cmake_minimum_required(VERSION 3.24)
+cmake_policy(SET CMP0141 NEW)
+
+# The debug information format flags do not change preprocessor definitions,
+# so override our table of flags to artificially add a definition we can check.
+set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/override-C.cmake)
+set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/override-CXX.cmake)
+set(CMAKE_USER_MAKE_RULES_OVERRIDE_CUDA ${CMAKE_CURRENT_SOURCE_DIR}/override-CUDA.cmake)
+set(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran ${CMAKE_CURRENT_SOURCE_DIR}/override-Fortran.cmake)
+
+project(MSVCDebugInformationFormat)
+if(CMake_TEST_CUDA)
+ enable_language(CUDA)
+endif()
+if(CMake_TEST_Fortran)
+ enable_language(Fortran)
+endif()
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+if("${CMAKE_C_COMPILER_ID};${CMAKE_C_SIMULATE_ID};${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "Clang;MSVC;GNU")
+ set(verify_default VERIFY_Z7)
+ set(NO_COMPILER_PDB 1)
+elseif("${CMAKE_C_COMPILER_ID};${CMAKE_C_SIMULATE_ID};${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "Clang;MSVC;MSVC")
+ set(verify_default VERIFY_Zi)
+ set(NO_EDIT_AND_CONTINUE 1)
+else()
+ set(verify_default VERIFY_Zi)
+endif()
+
+set(verify_def_Embedded -DVERIFY_Z7)
+set(verify_def_ProgramDatabase -DVERIFY_Zi)
+set(verify_def_EditAndContinue -DVERIFY_ZI)
+
+function(verify_combination format lang src)
+ # Test that try_compile builds with this debug format.
+ set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "${format}")
+ set(CMAKE_TRY_COMPILE_CONFIGURATION "Debug")
+ set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
+ try_compile(${format}_COMPILES
+ ${CMAKE_CURRENT_BINARY_DIR}/try_compile/${format}
+ ${CMAKE_CURRENT_SOURCE_DIR}/${src}
+ COMPILE_DEFINITIONS ${verify_def_${format}}
+ CMAKE_FLAGS -DINCLUDE_DIRECTORIES=${CMAKE_CURRENT_SOURCE_DIR}
+ OUTPUT_VARIABLE ${format}_OUTPUT
+ )
+ if(${format}_COMPILES)
+ message(STATUS "try_compile ${lang} with ${format} worked")
+ else()
+ string(REPLACE "\n" "\n " ${format}_OUTPUT " ${${format}_OUTPUT}")
+ message(SEND_ERROR "try_compile ${lang} with ${format} failed:\n${${format}_OUTPUT}")
+ endif()
+
+ # Test that targets build with this debug format.
+ set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<BOOL:$<TARGET_PROPERTY:BOOL_TRUE>>:${format}>$<$<BOOL:$<TARGET_PROPERTY:BOOL_FALSE>>:BadContent>")
+ add_library(${format}-${lang} ${src})
+ set_property(TARGET ${format}-${lang} PROPERTY BOOL_TRUE TRUE)
+ target_compile_definitions(${format}-${lang} PRIVATE ${verify_def_${format}})
+endfunction()
+
+function(verify lang src)
+ add_library(default-${lang} ${src})
+ target_compile_definitions(default-${lang} PRIVATE "$<$<CONFIG:Debug,RelWithDebInfo>:${verify_default}>")
+
+ verify_combination(Embedded ${lang} ${src})
+ if(NOT NO_COMPILER_PDB)
+ verify_combination(ProgramDatabase ${lang} ${src})
+ if(NOT NO_EDIT_AND_CONTINUE AND NOT lang MATCHES "^(Fortran)$")
+ verify_combination(EditAndContinue ${lang} ${src})
+ endif()
+ endif()
+endfunction()
+
+verify(C verify.c)
+verify(CXX verify.cxx)
+if(CMake_TEST_CUDA)
+ verify(CUDA verify.cu)
+endif()
+if(CMake_TEST_Fortran)
+ verify(Fortran verify.F90)
+endif()
diff --git a/Tests/MSVCDebugInformationFormat/override-C.cmake b/Tests/MSVCDebugInformationFormat/override-C.cmake
new file mode 100644
index 0000000..e8f5ae4
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/override-C.cmake
@@ -0,0 +1,7 @@
+set(var "CMAKE_C_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_Embedded")
+string(REPLACE "-Z7" "-Z7;-DTEST_Z7" "${var}" "${${var}}")
+string(REPLACE "-gcodeview" "-gcodeview;-DTEST_Z7" "${var}" "${${var}}")
+set(var "CMAKE_C_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase")
+string(REPLACE "-Zi" "-Zi;-DTEST_Zi" "${var}" "${${var}}")
+set(var "CMAKE_C_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_EditAndContinue")
+string(REPLACE "-ZI" "-ZI;-DTEST_ZI" "${var}" "${${var}}")
diff --git a/Tests/MSVCDebugInformationFormat/override-CUDA.cmake b/Tests/MSVCDebugInformationFormat/override-CUDA.cmake
new file mode 100644
index 0000000..f870775
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/override-CUDA.cmake
@@ -0,0 +1,6 @@
+set(var "CMAKE_CUDA_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_Embedded")
+string(REPLACE "-Z7" "-Z7;-DTEST_Z7" "${var}" "${${var}}")
+set(var "CMAKE_CUDA_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase")
+string(REPLACE "-Zi" "-Zi;-DTEST_Zi" "${var}" "${${var}}")
+set(var "CMAKE_CUDA_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_EditAndContinue")
+string(REPLACE "-ZI" "-ZI;-DTEST_ZI" "${var}" "${${var}}")
diff --git a/Tests/MSVCDebugInformationFormat/override-CXX.cmake b/Tests/MSVCDebugInformationFormat/override-CXX.cmake
new file mode 100644
index 0000000..caa23fe
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/override-CXX.cmake
@@ -0,0 +1,7 @@
+set(var "CMAKE_CXX_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_Embedded")
+string(REPLACE "-Z7" "-Z7;-DTEST_Z7" "${var}" "${${var}}")
+string(REPLACE "-gcodeview" "-gcodeview;-DTEST_Z7" "${var}" "${${var}}")
+set(var "CMAKE_CXX_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase")
+string(REPLACE "-Zi" "-Zi;-DTEST_Zi" "${var}" "${${var}}")
+set(var "CMAKE_CXX_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_EditAndContinue")
+string(REPLACE "-ZI" "-ZI;-DTEST_ZI" "${var}" "${${var}}")
diff --git a/Tests/MSVCDebugInformationFormat/override-Fortran.cmake b/Tests/MSVCDebugInformationFormat/override-Fortran.cmake
new file mode 100644
index 0000000..5d2db58
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/override-Fortran.cmake
@@ -0,0 +1,4 @@
+set(var "CMAKE_Fortran_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_Embedded")
+string(REPLACE "-Z7" "-Z7;-DTEST_Z7" "${var}" "${${var}}")
+set(var "CMAKE_Fortran_COMPILE_OPTIONS_MSVC_DEBUG_INFORMATION_FORMAT_ProgramDatabase")
+string(REPLACE "-Zi" "-Zi;-DTEST_Zi" "${var}" "${${var}}")
diff --git a/Tests/MSVCDebugInformationFormat/verify.F90 b/Tests/MSVCDebugInformationFormat/verify.F90
new file mode 100644
index 0000000..741bca6
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/verify.F90
@@ -0,0 +1 @@
+#include "verify.h"
diff --git a/Tests/MSVCDebugInformationFormat/verify.c b/Tests/MSVCDebugInformationFormat/verify.c
new file mode 100644
index 0000000..741bca6
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/verify.c
@@ -0,0 +1 @@
+#include "verify.h"
diff --git a/Tests/MSVCDebugInformationFormat/verify.cu b/Tests/MSVCDebugInformationFormat/verify.cu
new file mode 100644
index 0000000..741bca6
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/verify.cu
@@ -0,0 +1 @@
+#include "verify.h"
diff --git a/Tests/MSVCDebugInformationFormat/verify.cxx b/Tests/MSVCDebugInformationFormat/verify.cxx
new file mode 100644
index 0000000..741bca6
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/verify.cxx
@@ -0,0 +1 @@
+#include "verify.h"
diff --git a/Tests/MSVCDebugInformationFormat/verify.h b/Tests/MSVCDebugInformationFormat/verify.h
new file mode 100644
index 0000000..4bd6529
--- /dev/null
+++ b/Tests/MSVCDebugInformationFormat/verify.h
@@ -0,0 +1,29 @@
+#ifdef VERIFY_Z7
+# ifndef TEST_Z7
+# error "TEST_Z7 incorrectly not defined by debug format selection"
+# endif
+#else
+# ifdef TEST_Z7
+# error "TEST_Z7 incorrectly defined by non-debug format selection"
+# endif
+#endif
+
+#ifdef VERIFY_Zi
+# ifndef TEST_Zi
+# error "TEST_Zi incorrectly not defined by debug format selection"
+# endif
+#else
+# ifdef TEST_Zi
+# error "TEST_Zi incorrectly defined by non-debug format selection"
+# endif
+#endif
+
+#ifdef VERIFY_ZI
+# ifndef TEST_ZI
+# error "TEST_ZI incorrectly not defined by debug format selection"
+# endif
+#else
+# ifdef TEST_ZI
+# error "TEST_ZI incorrectly defined by non-debug format selection"
+# endif
+#endif
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 42ff450..db4200b 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -359,6 +359,7 @@ if(MSVC)
add_RunCMake_test(MSVCRuntimeLibrary)
add_RunCMake_test(MSVCRuntimeTypeInfo)
add_RunCMake_test(MSVCWarningFlags)
+ add_RunCMake_test(MSVCDebugInformationFormat)
endif()
if(XCODE_VERSION)
set(ObjectLibrary_ARGS -DXCODE_VERSION=${XCODE_VERSION})
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-result.txt b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-stderr.txt b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-stderr.txt
new file mode 100644
index 0000000..fb61d4b
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error in CMakeLists.txt:
+ MSVC_DEBUG_INFORMATION_FORMAT value 'BogusValue' not known for this (C|CXX)
+ compiler.
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW.cmake
new file mode 100644
index 0000000..165ea38
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0141 NEW)
+include(CMP0141-common.cmake)
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NoEffect.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NoEffect.cmake
new file mode 100644
index 0000000..82754a9
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-NoEffect.cmake
@@ -0,0 +1,4 @@
+include(CMP0141-common.cmake)
+
+# Setting this policy after enable_language command has no effect.
+cmake_policy(SET CMP0141 NEW)
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-OLD.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-OLD.cmake
new file mode 100644
index 0000000..7bbe586
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0141 OLD)
+include(CMP0141-common.cmake)
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-WARN.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-WARN.cmake
new file mode 100644
index 0000000..912112a
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMP0141-WARN.cmake
@@ -0,0 +1,2 @@
+
+include(CMP0141-common.cmake)
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)
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/CMakeLists.txt b/Tests/RunCMake/MSVCDebugInformationFormat/CMakeLists.txt
new file mode 100644
index 0000000..aba1016
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.24)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/RunCMakeTest.cmake b/Tests/RunCMake/MSVCDebugInformationFormat/RunCMakeTest.cmake
new file mode 100644
index 0000000..f678acf
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/RunCMakeTest.cmake
@@ -0,0 +1,6 @@
+include(RunCMake)
+
+run_cmake(CMP0141-WARN)
+run_cmake(CMP0141-OLD)
+run_cmake(CMP0141-NEW)
+run_cmake(CMP0141-NoEffect)
diff --git a/Tests/RunCMake/MSVCDebugInformationFormat/empty.cxx b/Tests/RunCMake/MSVCDebugInformationFormat/empty.cxx
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/MSVCDebugInformationFormat/empty.cxx
diff --git a/Tests/RunCMake/VS10Project/DebugInformationFormat-check.cmake b/Tests/RunCMake/VS10Project/DebugInformationFormat-check.cmake
new file mode 100644
index 0000000..46af974
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/DebugInformationFormat-check.cmake
@@ -0,0 +1,46 @@
+macro(DebugInformationFormat_check tgt Debug_expect Release_expect MinSizeRel_expect RelWithDebInfo_expect)
+ set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${tgt}.vcxproj")
+ if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not exist.")
+ return()
+ endif()
+
+ set(Debug_actual "")
+ set(Release_actual "")
+ set(MinSizeRel_actual "")
+ set(RelWithDebInfo_actual "")
+
+ file(STRINGS "${vcProjectFile}" lines)
+ foreach(line IN LISTS lines)
+ if(line MATCHES "^ *<ItemDefinitionGroup Condition=\"'\\$\\(Configuration\\)\\|\\$\\(Platform\\)'=='([^<>]+)\\|[A-Za-z0-9_]+'\">")
+ set(Configuration "${CMAKE_MATCH_1}")
+ endif()
+ if(line MATCHES "^ *<DebugInformationFormat>([^<>]+)</DebugInformationFormat>")
+ set(${Configuration}_actual "${CMAKE_MATCH_1}")
+ endif()
+ endforeach()
+
+ if (NOT "${Debug_actual}" STREQUAL "${Debug_expect}")
+ set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj Debug Configuration has DebugInformationFormat '${Debug_actual}', not '${Debug_expect}'.")
+ endif()
+ if (NOT "${Release_actual}" STREQUAL "${Release_expect}")
+ set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj Release Configuration has DebugInformationFormat '${Release_actual}', not '${Release_expect}'.")
+ endif()
+ if (NOT "${MinSizeRel_actual}" STREQUAL "${MinSizeRel_expect}")
+ set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj MinSizeRel Configuration has DebugInformationFormat '${MinSizeRel_actual}', not '${MinSizeRel_expect}'.")
+ endif()
+ if (NOT "${RelWithDebInfo_actual}" STREQUAL "${RelWithDebInfo_expect}")
+ set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj RelWithDebInfo Configuration has DebugInformationFormat '${RelWithDebInfo_actual}', not '${RelWithDebInfo_expect}'.")
+ endif()
+endmacro()
+
+DebugInformationFormat_check(default-C ProgramDatabase "" "" ProgramDatabase)
+DebugInformationFormat_check(default-CXX ProgramDatabase "" "" ProgramDatabase)
+DebugInformationFormat_check(empty-C "" "" "" "")
+DebugInformationFormat_check(empty-CXX "" "" "" "")
+DebugInformationFormat_check(Embedded-C OldStyle OldStyle OldStyle OldStyle)
+DebugInformationFormat_check(Embedded-CXX OldStyle OldStyle OldStyle OldStyle)
+DebugInformationFormat_check(ProgramDatabase-C ProgramDatabase ProgramDatabase ProgramDatabase ProgramDatabase)
+DebugInformationFormat_check(ProgramDatabase-CXX ProgramDatabase ProgramDatabase ProgramDatabase ProgramDatabase)
+DebugInformationFormat_check(EditAndContinue-C EditAndContinue EditAndContinue EditAndContinue EditAndContinue)
+DebugInformationFormat_check(EditAndContinue-CXX EditAndContinue EditAndContinue EditAndContinue EditAndContinue)
diff --git a/Tests/RunCMake/VS10Project/DebugInformationFormat.cmake b/Tests/RunCMake/VS10Project/DebugInformationFormat.cmake
new file mode 100644
index 0000000..f670166
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/DebugInformationFormat.cmake
@@ -0,0 +1,24 @@
+set(CMAKE_CONFIGURATION_TYPES Debug Release MinSizeRel RelWithDebInfo)
+cmake_policy(SET CMP0141 NEW)
+enable_language(C)
+enable_language(CXX)
+
+add_library(default-C empty.c)
+add_library(default-CXX empty.cxx)
+
+set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "")
+add_library(empty-C empty.c)
+add_library(empty-CXX empty.cxx)
+
+set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "Embedded")
+add_library(Embedded-C empty.c)
+add_library(Embedded-CXX empty.cxx)
+
+set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase")
+add_library(ProgramDatabase-C empty.c)
+add_library(ProgramDatabase-CXX empty.cxx)
+
+add_library(EditAndContinue-C empty.c)
+set_property(TARGET EditAndContinue-C PROPERTY MSVC_DEBUG_INFORMATION_FORMAT "EditAndContinue")
+add_library(EditAndContinue-CXX empty.cxx)
+set_property(TARGET EditAndContinue-CXX PROPERTY MSVC_DEBUG_INFORMATION_FORMAT "EditAndContinue")
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index e540b9f..f027e94 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -88,3 +88,4 @@ run_cmake(VsDotnetStartupObject)
run_cmake(VsDotnetTargetFramework)
run_cmake(VsDotnetTargetFrameworkVersion)
run_cmake(VsNoCompileBatching)
+run_cmake(DebugInformationFormat)