2012-06-29 06:32:01 +00:00
|
|
|
|
2012-08-31 09:59:30 +00:00
|
|
|
set(BUILD_OPTIONS_LIST)
|
|
|
|
|
|
|
|
if (CMAKE_BUILD_TYPE)
|
|
|
|
list(APPEND BUILD_OPTIONS_LIST "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (CMAKE_TOOLCHAIN_FILE)
|
|
|
|
list(APPEND BUILD_OPTIONS_LIST "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
|
|
|
|
endif()
|
|
|
|
|
2012-06-29 06:32:01 +00:00
|
|
|
macro(expect_pass _dir)
|
|
|
|
string(REPLACE "(" "_" testname "${_dir}")
|
|
|
|
string(REPLACE ")" "_" testname "${testname}")
|
|
|
|
add_test(${testname} ${CMAKE_CTEST_COMMAND}
|
|
|
|
--build-and-test
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/${_dir}"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${_dir}"
|
|
|
|
--build-generator ${CMAKE_GENERATOR}
|
|
|
|
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
|
2012-09-21 13:11:54 +00:00
|
|
|
--build-project ${_dir}
|
2012-08-31 09:59:30 +00:00
|
|
|
--build-options "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" ${BUILD_OPTIONS_LIST}
|
2012-06-29 06:32:01 +00:00
|
|
|
)
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(expect_fail _dir)
|
|
|
|
string(REPLACE "(" "_" testname "${_dir}")
|
|
|
|
string(REPLACE ")" "_" testname "${testname}")
|
|
|
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}")
|
|
|
|
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/${_dir}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}")
|
2012-07-10 15:56:54 +00:00
|
|
|
|
|
|
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}/${_dir}/FindPackageHints.cmake" "set(Qt5Tests_PREFIX_PATH \"${CMAKE_PREFIX_PATH}\")")
|
|
|
|
|
2012-06-29 06:32:01 +00:00
|
|
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}/CMakeLists.txt"
|
|
|
|
"
|
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2012-09-21 13:02:44 +00:00
|
|
|
project(${_dir})
|
2012-06-29 06:32:01 +00:00
|
|
|
|
|
|
|
try_compile(Result \${CMAKE_CURRENT_BINARY_DIR}/${_dir}
|
|
|
|
\${CMAKE_CURRENT_SOURCE_DIR}/${_dir}
|
|
|
|
${_dir}
|
|
|
|
OUTPUT_VARIABLE Out
|
|
|
|
)
|
|
|
|
message(\"\${Out}\")
|
|
|
|
if (Result)
|
|
|
|
message(SEND_ERROR \"Succeeded build which should fail\")
|
|
|
|
endif()
|
|
|
|
"
|
|
|
|
)
|
|
|
|
add_test(${testname} ${CMAKE_CTEST_COMMAND}
|
|
|
|
--build-and-test
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}/build"
|
|
|
|
--build-generator ${CMAKE_GENERATOR}
|
|
|
|
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
|
2012-09-21 13:11:54 +00:00
|
|
|
--build-project ${_dir}
|
2012-08-31 09:59:30 +00:00
|
|
|
--build-options "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" ${BUILD_OPTIONS_LIST}
|
2012-06-29 06:32:01 +00:00
|
|
|
)
|
|
|
|
endmacro()
|