diff options
author | Stuart Dootson <stuart.dootson@gmail.com> | 2019-10-07 09:43:10 +0200 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2019-10-11 11:00:05 +0200 |
commit | 36f3c78d543495bd951e86e7b11e8462f303a227 (patch) | |
tree | 8c225c669cd8b6a6fc5469c26df4f6a078f8c27e | |
parent | 3864871d3acd652402198b889cfad35bb8802aac (diff) | |
download | sigc++-36f3c78d543495bd951e86e7b11e8462f303a227.tar.gz |
CMake Build: tests: Let MSVC find the library
Use 'cmake -E env ... <test-executable>' to execute the test executable.
The '-E env' option allows the environment to be altered for the executed test.
Use generator expressions to retrieve the build directory/file for the
sigc++ & test targets
-rw-r--r-- | tests/CMakeLists.txt | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index feb4eef..a9e5670 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -61,7 +61,9 @@ function (add_sigcpp_test TEST_SOURCE_FILE) get_filename_component (test_name ${TEST_SOURCE_FILE} NAME_WE) add_executable (${test_name} ${TEST_SOURCE_FILE} testutilities.cc) target_link_libraries (${test_name} sigc-${SIGCXX_API_VERSION}) - add_test (${test_name} ${CMAKE_CURRENT_BINARY_DIR}/${test_name}) + add_test (NAME ${test_name} + # Help MSVC to find the library that the tests should link against. + COMMAND ${CMAKE_COMMAND} -E env "PATH=$<TARGET_FILE_DIR:sigc-${SIGCXX_API_VERSION}>;$ENV{PATH}" $<TARGET_FILE:${test_name}>) endfunction (add_sigcpp_test) foreach (test_file ${TEST_SOURCE_FILES}) |