Skip to content

Commit 5936342

Browse files
Copy DLL to test directory for windows tests to find shared library
1 parent 1103b6a commit 5936342

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,16 @@ endforeach()
9191
# Copy test data directory to build directory
9292
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/data
9393
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
94+
95+
# On Windows, copy the shared library DLL to the test output directory
96+
# so that tests can find it at runtime
97+
if(WIN32 AND TARGET mseed_shared)
98+
# Use the first test program to determine the output directory
99+
list(GET TEST_PROGRAMS 0 FIRST_TEST)
100+
add_custom_command(TARGET ${FIRST_TEST} POST_BUILD
101+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
102+
$<TARGET_FILE:mseed_shared>
103+
$<TARGET_FILE_DIR:${FIRST_TEST}>
104+
COMMENT "Copying mseed DLL to test directory"
105+
)
106+
endif()

0 commit comments

Comments
 (0)