Skip to content

Commit 60c1ea3

Browse files
committed
Symlink test data files
1 parent 7709937 commit 60c1ea3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

cmake/OpenSimMacros.cmake

+9-3
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,15 @@ function(OpenSimAddTests)
390390

391391
# Copy data files to build directory.
392392
foreach(data_file ${OSIMADDTESTS_DATAFILES})
393-
# This command re-copies the data files if they are modified;
394-
# custom commands don't do this.
395-
file(COPY "${data_file}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
393+
# This command symlinks the data files
394+
# from the source directories into the running directory.
395+
# This preserves changes to source files copying.
396+
get_filename_component(FILENAME ${data_file} NAME)
397+
add_custom_command(
398+
TARGET ${TEST_NAME} POST_BUILD
399+
COMMAND ${CMAKE_COMMAND} -E create_symlink
400+
${data_file}
401+
$<TARGET_FILE_DIR:${TEST_NAME}>/${FILENAME})
396402
endforeach()
397403

398404
#if(UNIX)

0 commit comments

Comments
 (0)