Skip to content

Commit aaeb223

Browse files
prefer static build for tests on windows to avoid dll search path issues
1 parent 5936342 commit aaeb223

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

test/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ set(EXAMPLE_TESTS
2626
lm_timestr
2727
)
2828

29-
# Determine which library target to use (prefer shared if available)
30-
if(TARGET mseed_shared)
29+
# Determine which library target to use
30+
# On Windows, prefer static to avoid DLL path issues during testing
31+
if(WIN32 AND TARGET mseed_static)
32+
set(MSEED_TEST_LIBRARY mseed_static)
33+
elseif(TARGET mseed_shared)
3134
set(MSEED_TEST_LIBRARY mseed_shared)
3235
elseif(TARGET mseed_static)
3336
set(MSEED_TEST_LIBRARY mseed_static)
@@ -92,9 +95,9 @@ endforeach()
9295
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/data
9396
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
9497

95-
# On Windows, copy the shared library DLL to the test output directory
98+
# On Windows with shared library, copy the DLL to the test output directory
9699
# so that tests can find it at runtime
97-
if(WIN32 AND TARGET mseed_shared)
100+
if(WIN32 AND MSEED_TEST_LIBRARY STREQUAL "mseed_shared")
98101
# Use the first test program to determine the output directory
99102
list(GET TEST_PROGRAMS 0 FIRST_TEST)
100103
add_custom_command(TARGET ${FIRST_TEST} POST_BUILD

0 commit comments

Comments
 (0)