@@ -386,20 +386,27 @@ function(OpenSimAddTests)
386
386
set_target_properties (${TEST_NAME} PROPERTIES
387
387
FOLDER "Tests"
388
388
)
389
+ # Link data files to build directory.
390
+ foreach (data_file ${OSIMADDTESTS_DATAFILES} )
391
+ # This command symlinks the data files
392
+ # from the source directories into the running directory.
393
+ # This preserves changes to source files.
394
+ get_filename_component (FILENAME ${data_file} NAME )
395
+ set (link_path "${CMAKE_CURRENT_BINARY_DIR} /${FILENAME} " )
396
+ if (NOT EXISTS "${link_path} " )
397
+ add_custom_command (
398
+ TARGET ${TEST_NAME} POST_BUILD
399
+ COMMAND ${CMAKE_COMMAND} -E create_symlink
400
+ "${data_file} "
401
+ "${link_path} "
402
+ COMMENT "Creating symlink: ${data_file} -> ${link_path} "
403
+ )
404
+ else ()
405
+ message (STATUS "Skipping ${data_file} , it already exists in the build directory." )
406
+ endif ()
407
+ endforeach ()
389
408
endforeach ()
390
409
391
- # Copy data files to build directory.
392
- foreach (data_file ${OSIMADDTESTS_DATAFILES} )
393
- # This command symlinks the data files
394
- # from the source directories into the running directory.
395
- # This preserves changes to source files.
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} )
402
- endforeach ()
403
410
404
411
#if(UNIX)
405
412
# add_definitions(-fprofile-arcs -ftest-coverage)
0 commit comments