CMakeTests: allow to call the check_cmake_test macro with a given file

This allows to generate a lot of simple files directly in the test tree instead
of having them all checked in.
This commit is contained in:
Rolf Eike Beer 2012-11-01 13:26:23 +01:00
parent 8956b7e887
commit d211e5d203
1 changed files with 29 additions and 24 deletions

View File

@ -1,10 +1,9 @@
get_filename_component(CMakeTests_SRC_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
function(check_cmake_test prefix)
get_filename_component(CMakeTests_BIN_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
foreach(test ${ARGN})
function(check_cmake_test_single prefix test testfile)
message(STATUS "Test ${prefix}-${test}...")
execute_process(
COMMAND ${CMAKE_COMMAND} -P "${CMakeTests_SRC_DIR}/${prefix}-${test}.cmake"
COMMAND ${CMAKE_COMMAND} -P "${testfile}"
WORKING_DIRECTORY "${CMakeTests_BIN_DIR}"
OUTPUT_VARIABLE stdout
ERROR_VARIABLE stderr
@ -26,5 +25,11 @@ function(check_cmake_test prefix)
"${out}\n"
"${err}")
endif()
endfunction()
function(check_cmake_test prefix)
get_filename_component(CMakeTests_BIN_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
foreach(test ${ARGN})
check_cmake_test_single("${prefix}" "${test}" "${CMakeTests_SRC_DIR}/${prefix}-${test}.cmake")
endforeach()
endfunction()