Imported Upstream version 3.25.0
[platform/upstream/cmake.git] / Tests / RunCMake / VS10Project / DebugInformationFormat-check.cmake
1 macro(DebugInformationFormat_check tgt Debug_expect Release_expect MinSizeRel_expect RelWithDebInfo_expect)
2   set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${tgt}.vcxproj")
3   if(NOT EXISTS "${vcProjectFile}")
4     set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not exist.")
5     return()
6   endif()
7
8   set(Debug_actual "")
9   set(Release_actual "")
10   set(MinSizeRel_actual "")
11   set(RelWithDebInfo_actual "")
12
13   file(STRINGS "${vcProjectFile}" lines)
14   foreach(line IN LISTS lines)
15     if(line MATCHES "^ *<ItemDefinitionGroup Condition=\"'\\$\\(Configuration\\)\\|\\$\\(Platform\\)'=='([^<>]+)\\|[A-Za-z0-9_]+'\">")
16       set(Configuration "${CMAKE_MATCH_1}")
17     endif()
18     if(line MATCHES "^ *<DebugInformationFormat>([^<>]+)</DebugInformationFormat>")
19       set(${Configuration}_actual "${CMAKE_MATCH_1}")
20     endif()
21   endforeach()
22
23   if (NOT "${Debug_actual}" STREQUAL "${Debug_expect}")
24     set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj Debug Configuration has DebugInformationFormat '${Debug_actual}', not '${Debug_expect}'.")
25   endif()
26   if (NOT "${Release_actual}" STREQUAL "${Release_expect}")
27     set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj Release Configuration has DebugInformationFormat '${Release_actual}', not '${Release_expect}'.")
28   endif()
29   if (NOT "${MinSizeRel_actual}" STREQUAL "${MinSizeRel_expect}")
30     set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj MinSizeRel Configuration has DebugInformationFormat '${MinSizeRel_actual}', not '${MinSizeRel_expect}'.")
31   endif()
32   if (NOT "${RelWithDebInfo_actual}" STREQUAL "${RelWithDebInfo_expect}")
33     set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj RelWithDebInfo Configuration has DebugInformationFormat '${RelWithDebInfo_actual}', not '${RelWithDebInfo_expect}'.")
34   endif()
35 endmacro()
36
37 DebugInformationFormat_check(default-C ProgramDatabase "" "" ProgramDatabase)
38 DebugInformationFormat_check(default-CXX ProgramDatabase "" "" ProgramDatabase)
39 DebugInformationFormat_check(empty-C "" "" "" "")
40 DebugInformationFormat_check(empty-CXX "" "" "" "")
41 DebugInformationFormat_check(Embedded-C OldStyle OldStyle OldStyle OldStyle)
42 DebugInformationFormat_check(Embedded-CXX OldStyle OldStyle OldStyle OldStyle)
43 DebugInformationFormat_check(ProgramDatabase-C ProgramDatabase ProgramDatabase ProgramDatabase ProgramDatabase)
44 DebugInformationFormat_check(ProgramDatabase-CXX ProgramDatabase ProgramDatabase ProgramDatabase ProgramDatabase)
45 DebugInformationFormat_check(EditAndContinue-C EditAndContinue EditAndContinue EditAndContinue EditAndContinue)
46 DebugInformationFormat_check(EditAndContinue-CXX EditAndContinue EditAndContinue EditAndContinue EditAndContinue)