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:
parent
8956b7e887
commit
d211e5d203
@ -1,10 +1,9 @@
|
|||||||
get_filename_component(CMakeTests_SRC_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
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)
|
function(check_cmake_test_single prefix test testfile)
|
||||||
foreach(test ${ARGN})
|
|
||||||
message(STATUS "Test ${prefix}-${test}...")
|
message(STATUS "Test ${prefix}-${test}...")
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${CMAKE_COMMAND} -P "${CMakeTests_SRC_DIR}/${prefix}-${test}.cmake"
|
COMMAND ${CMAKE_COMMAND} -P "${testfile}"
|
||||||
WORKING_DIRECTORY "${CMakeTests_BIN_DIR}"
|
WORKING_DIRECTORY "${CMakeTests_BIN_DIR}"
|
||||||
OUTPUT_VARIABLE stdout
|
OUTPUT_VARIABLE stdout
|
||||||
ERROR_VARIABLE stderr
|
ERROR_VARIABLE stderr
|
||||||
@ -26,5 +25,11 @@ function(check_cmake_test prefix)
|
|||||||
"${out}\n"
|
"${out}\n"
|
||||||
"${err}")
|
"${err}")
|
||||||
endif()
|
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()
|
endforeach()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user