Test.cmake.in 916 B

123456789101112131415161718192021222324252627282930313233
  1. if (NOT TEST_SOURCE)
  2. set(TEST_SOURCE "${TEST}")
  3. endif ()
  4. set(make_program "@CMake_TEST_EXPLICIT_MAKE_PROGRAM@")
  5. if(make_program)
  6. set(maybe_make_program "-DCMAKE_MAKE_PROGRAM=${make_program}")
  7. endif()
  8. set(_isMultiConfig "@_isMultiConfig@")
  9. if(_isMultiConfig)
  10. set(cfg_opts "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;RelWithDebInfo")
  11. else()
  12. set(cfg_opts)
  13. endif()
  14. set(source_dir "@CMAKE_CURRENT_SOURCE_DIR@/${TEST_SOURCE}")
  15. set(binary_dir "@CMAKE_CURRENT_BINARY_DIR@/${TEST}-build")
  16. file(REMOVE_RECURSE "${binary_dir}")
  17. file(MAKE_DIRECTORY "${binary_dir}")
  18. execute_process(
  19. COMMAND ${CMAKE_COMMAND} ${CMAKE_ARGS}
  20. "${source_dir}" -G "@CMAKE_GENERATOR@"
  21. -A "@CMAKE_GENERATOR_PLATFORM@"
  22. -T "@CMAKE_GENERATOR_TOOLSET@"
  23. ${cfg_opts}
  24. ${maybe_make_program}
  25. WORKING_DIRECTORY "${binary_dir}"
  26. RESULT_VARIABLE result
  27. )
  28. if(result)
  29. message(FATAL_ERROR "CMake failed to configure ${TEST}")
  30. endif()