2 macro(expect_pass _dir)
3 string(REPLACE "(" "_" testname "${_dir}")
4 string(REPLACE ")" "_" testname "${testname}")
5 add_test(${testname} ${CMAKE_CTEST_COMMAND}
7 "${CMAKE_CURRENT_SOURCE_DIR}/${_dir}"
8 "${CMAKE_CURRENT_BINARY_DIR}/${_dir}"
9 --build-generator ${CMAKE_GENERATOR}
10 --build-makeprogram ${CMAKE_MAKE_PROGRAM}
11 --build-options "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"
15 macro(expect_fail _dir)
16 string(REPLACE "(" "_" testname "${_dir}")
17 string(REPLACE ")" "_" testname "${testname}")
18 file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}")
19 file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/${_dir}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}")
20 file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}/CMakeLists.txt"
22 cmake_minimum_required(VERSION 2.8)
23 project(${_dir}_build)
25 try_compile(Result \${CMAKE_CURRENT_BINARY_DIR}/${_dir}
26 \${CMAKE_CURRENT_SOURCE_DIR}/${_dir}
32 message(SEND_ERROR \"Succeeded build which should fail\")
36 add_test(${testname} ${CMAKE_CTEST_COMMAND}
38 "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}"
39 "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}/build"
40 --build-generator ${CMAKE_GENERATOR}
41 --build-makeprogram ${CMAKE_MAKE_PROGRAM}
42 --build-options "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"