copy test files with ADD_CUSTOM_COMMAND

This will copy the files every time "make test" is called, so the files are never out of sync.

Fixes issue #4633
This commit is contained in:
Markus Reitboeck 2018-01-06 13:07:12 +01:00 committed by ridiculousfish
parent 8a67a113d8
commit 843ac2554d

View file

@ -14,9 +14,15 @@ SET(TEST_ROOT_DIR ${TEST_DIR}/root)
# Copy tests files.
FILE(GLOB TESTS_FILES tests/*)
FILE(COPY ${TESTS_FILES} DESTINATION tests/)
ADD_CUSTOM_TARGET(tests_dir DEPENDS tests)
ADD_CUSTOM_COMMAND(TARGET tests_dir
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/tests/ ${CMAKE_BINARY_DIR}/tests/
COMMENT "Copying test files to binary dir"
VERBATIM)
ADD_DEPENDENCIES(fish_tests tests_dir)
# Create the 'test' target.
@ -33,7 +39,7 @@ ADD_CUSTOM_TARGET(test_low_level
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS fish_tests
USES_TERMINAL)
ADD_DEPENDENCIES(test test_low_level)
ADD_DEPENDENCIES(test test_low_level tests_dir)
# Make the directory in which to run tests.
# Also symlink fish to where the tests expect it to be.