RuntimeLibrary-check.cmake 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. macro(RuntimeLibrary_check tgt rtl_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(HAVE_Runtimelibrary 0)
  8. file(STRINGS "${vcProjectFile}" lines)
  9. foreach(line IN LISTS lines)
  10. if(line MATCHES "^ *<RuntimeLibrary>([^<>]+)</RuntimeLibrary>")
  11. set(rtl_actual "${CMAKE_MATCH_1}")
  12. if(NOT "${rtl_actual}" STREQUAL "${rtl_expect}")
  13. set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj has RuntimeLibrary '${rtl_actual}', not '${rtl_expect}'.")
  14. return()
  15. endif()
  16. set(HAVE_Runtimelibrary 1)
  17. break()
  18. endif()
  19. endforeach()
  20. if(NOT HAVE_Runtimelibrary AND NOT "${rtl_expect}" STREQUAL "")
  21. set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a RuntimeLibrary field.")
  22. return()
  23. endif()
  24. endmacro()
  25. RuntimeLibrary_check(default-C MultiThreadedDebugDLL)
  26. RuntimeLibrary_check(default-CXX MultiThreadedDebugDLL)
  27. RuntimeLibrary_check(empty-C "")
  28. RuntimeLibrary_check(empty-CXX "")
  29. RuntimeLibrary_check(MTd-C MultiThreadedDebug)
  30. RuntimeLibrary_check(MTd-CXX MultiThreadedDebug)
  31. RuntimeLibrary_check(MT-C MultiThreaded)
  32. RuntimeLibrary_check(MT-CXX MultiThreaded)