Skip to content

Commit dc68a90

Browse files
authored
fix: unit tests are now built statically when BUILD_SHARED_LIBS is off (#1193)
1 parent 5bf88c2 commit dc68a90

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

library/CMakeLists.txt

+5-3
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ if(NOT BUILD_SHARED_LIBS)
111111
endif()
112112
endif()
113113

114-
include("${CMAKE_CURRENT_SOURCE_DIR}/../cmake/colour.cmake")
115-
116114
if (BUILD_VOICE_SUPPORT)
117115
if (MINGW OR NOT WIN32)
118116
find_package(PkgConfig QUIET)
@@ -361,7 +359,11 @@ if (DPP_BUILD_TEST)
361359
if (MSVC)
362360
target_compile_options(${testname} PRIVATE /utf-8)
363361
endif()
364-
target_link_libraries(${testname} PUBLIC ${modname})
362+
set (static_if_needed "")
363+
if(NOT BUILD_SHARED_LIBS)
364+
set (static_if_needed "-static")
365+
endif()
366+
target_link_libraries(${testname} PUBLIC ${modname} ${static_if_needed})
365367
endif()
366368
endforeach()
367369
add_test(

0 commit comments

Comments
 (0)