diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ad224b4..d2688da 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -20,6 +20,14 @@ foreach(TEST ${TESTS}) target_link_libraries(${TEST} QHttpEngine common) add_test(NAME ${TEST} COMMAND ${TEST} - WORKING_DIRECTORY "$" ) endforeach() + +# On Windows, the library's DLL must exist in the same directory as the test +# executables which link against it - create a custom command to copy it +if(WIN32 NOT BUILD_STATIC) + add_custom_target(QHttpEngine-copy ALL + "${CMAKE_COMMAND}" -E copy "$" "${CMAKE_CURRENT_BINARY_DIR}" + DEPENDS QHttpEngine + ) +endif()