testUtilDataPath: use CMAKE_CURRENT_SOURCE_DIR env to work out-of-tree (#234)

This commit is contained in:
gitlost
2021-07-07 14:47:25 +01:00
parent 7379acd4a4
commit 4d9aa96453
2 changed files with 24 additions and 8 deletions

View File

@ -8,9 +8,11 @@ macro(zint_add_test test_name test_command)
add_executable(${test_command} ${test_command}.c)
target_link_libraries(${test_command} testcommon ${ADDITIONAL_LIBS})
add_test(${test_name} ${test_command})
set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}")
if(ZINT_STATIC)
add_executable(${test_command}-static ${test_command}.c)
target_link_libraries(${test_command}-static testcommon-static ${ADDITIONAL_LIBS})
add_test(${test_name}-static ${test_command}-static)
set_tests_properties(${test_name}-static PROPERTIES ENVIRONMENT "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}")
endif()
endmacro()