DebugInformationFormat-check.cmake 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. set(Debug_actual "")
  8. set(Release_actual "")
  9. set(MinSizeRel_actual "")
  10. set(RelWithDebInfo_actual "")
  11. file(STRINGS "${vcProjectFile}" lines)
  12. foreach(line IN LISTS lines)
  13. if(line MATCHES "^ *<ItemDefinitionGroup Condition=\"'\\$\\(Configuration\\)\\|\\$\\(Platform\\)'=='([^<>]+)\\|[A-Za-z0-9_]+'\">")
  14. set(Configuration "${CMAKE_MATCH_1}")
  15. endif()
  16. if(line MATCHES "^ *<DebugInformationFormat>([^<>]+)</DebugInformationFormat>")
  17. set(${Configuration}_actual "${CMAKE_MATCH_1}")
  18. endif()
  19. endforeach()
  20. if (NOT "${Debug_actual}" STREQUAL "${Debug_expect}")
  21. set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj Debug Configuration has DebugInformationFormat '${Debug_actual}', not '${Debug_expect}'.")
  22. endif()
  23. if (NOT "${Release_actual}" STREQUAL "${Release_expect}")
  24. set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj Release Configuration has DebugInformationFormat '${Release_actual}', not '${Release_expect}'.")
  25. endif()
  26. if (NOT "${MinSizeRel_actual}" STREQUAL "${MinSizeRel_expect}")
  27. set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj MinSizeRel Configuration has DebugInformationFormat '${MinSizeRel_actual}', not '${MinSizeRel_expect}'.")
  28. endif()
  29. if (NOT "${RelWithDebInfo_actual}" STREQUAL "${RelWithDebInfo_expect}")
  30. set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj RelWithDebInfo Configuration has DebugInformationFormat '${RelWithDebInfo_actual}', not '${RelWithDebInfo_expect}'.")
  31. endif()
  32. endmacro()
  33. DebugInformationFormat_check(default-C ProgramDatabase "" "" ProgramDatabase)
  34. DebugInformationFormat_check(default-CXX ProgramDatabase "" "" ProgramDatabase)
  35. DebugInformationFormat_check(empty-C "" "" "" "")
  36. DebugInformationFormat_check(empty-CXX "" "" "" "")
  37. DebugInformationFormat_check(Embedded-C OldStyle OldStyle OldStyle OldStyle)
  38. DebugInformationFormat_check(Embedded-CXX OldStyle OldStyle OldStyle OldStyle)
  39. DebugInformationFormat_check(ProgramDatabase-C ProgramDatabase ProgramDatabase ProgramDatabase ProgramDatabase)
  40. DebugInformationFormat_check(ProgramDatabase-CXX ProgramDatabase ProgramDatabase ProgramDatabase ProgramDatabase)
  41. DebugInformationFormat_check(EditAndContinue-C EditAndContinue EditAndContinue EditAndContinue EditAndContinue)
  42. DebugInformationFormat_check(EditAndContinue-CXX EditAndContinue EditAndContinue EditAndContinue EditAndContinue)