diff --git a/tests/tests.cmake b/tests/tests.cmake index eff63d86..e60d1a2d 100644 --- a/tests/tests.cmake +++ b/tests/tests.cmake @@ -87,14 +87,12 @@ if(BUILD_TESTING) target_link_libraries("${TEST}" PRIVATE liblzma tests_w32res) - # Put the test programs into their own subdirectory so they don't - # pollute the top-level dir which might contain xz and xzdec. - set_target_properties("${TEST}" PROPERTIES - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/tests_bin" - ) - + # We used to put the test executables into their own subdirectory, + # but it can create problems on Windows when BUILD_SHARED_LIBS=ON. + # The executables and liblzma.dll should be in the same directory to + # ensure that the correct liblzma.dll file is always found and used. add_test(NAME "${TEST}" - COMMAND "${CMAKE_CURRENT_BINARY_DIR}/tests_bin/${TEST}" + COMMAND "${CMAKE_CURRENT_BINARY_DIR}/${TEST}" ) # Set srcdir environment variable so that the tests find their