You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am trying to specify shared libs paths to tests. It was fine for 1 library to add it to DL_PATHS of catch_discover_tests(), but adding more paths has no effect.
catch_discover_tests(Tests
DL_PATHS
"${path_to_A}/lib""${path_to_B}/lib"# test executable won't use it
)
I understood it with some tricky logic:
Library A is 3rd party and no such on system.
Library B is 3rd party too, but system has it analog with a little changed functionality (say older version). So without providing path B my executable runs, but fails internally.
see only one lib in PATH, but DL_PATHS provided with 2.
Expected behavior
Test executable would have PATH prefixed with all paths provided in DL_PATHS parameter of catch_discover_tests()
Reproduction steps
You can try having small repro with such
enable_testing()
include(FetchContent)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_PROGRESS TRUE
GIT_SHALLOW TRUE
GIT_TAG v3.4.0 # I used this version
)
FetchContent_MakeAvailable(Catch2)
# define test executable and link shared/imported libs
...
catch_discover_tests(Tests
EXTRA_ARGS ${TEST_ARGS}
DL_PATHS
"$Env{PATH}""${path_to_A}/lib")
i.e. I added needed library after some placeholder. It won't work either
Platform information:
OS: Windows 10.0.20348.0
Compiler+version: MSVC 17 19.36.32532.0
Catch version: v3.4.0
cmake 3.26.4
Additional context
I see DL_PATHS passed somewhere on POST_BUILD branch:
-D "TEST_DL_PATHS=${_DL_PATHS}"
The text was updated successfully, but these errors were encountered:
This happens because the call to cmake_parse_arguments() inside function(catch_discover_tests_impl) in CatchAddTests.cmake has TEST_DL_PATHS in the one-value keywords list, instead of the multi-value keywords list.
So dl_paths should have escaped ; or :. I am not sure if it gets double escaped in this case.
But btw, there is a more easier approach to DL_PATHS using TARGET_RUNTIME_DLL_DIRS. I will write a simple PR to add this for CMake >= 3.27
Edit: Actually you are right about the multi-value, I did a quick test with it and indeed it succeeded. It even worked as a gen-ex: DL_PATHS "$<TARGET_RUNTIME_DLL_DIRS:test-suite>"
Describe the bug
I am trying to specify shared libs paths to tests. It was fine for 1 library to add it to
DL_PATHS
ofcatch_discover_tests()
, but adding more paths has no effect.I understood it with some tricky logic:
A
is 3rd party and no such on system.B
is 3rd party too, but system has it analog with a little changed functionality (say older version). So without providing pathB
my executable runs, but fails internally.When running
ctest --verbose
I saw:see only one lib in
PATH
, butDL_PATHS
provided with 2.Expected behavior
Test executable would have
PATH
prefixed with all paths provided inDL_PATHS
parameter ofcatch_discover_tests()
Reproduction steps
You can try having small repro with such
i.e. I added needed library after some placeholder. It won't work either
Platform information:
Additional context
I see DL_PATHS passed somewhere on POST_BUILD branch:
The text was updated successfully, but these errors were encountered: