From 843ac2554dec950df21420be06b808fc01d14b0b Mon Sep 17 00:00:00 2001 From: Markus Reitboeck Date: Sat, 6 Jan 2018 13:07:12 +0100 Subject: [PATCH] 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 --- cmake/Tests.cmake | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmake/Tests.cmake b/cmake/Tests.cmake index e046fbca4..f19e78118 100644 --- a/cmake/Tests.cmake +++ b/cmake/Tests.cmake @@ -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.