From dc68a905684eede992fa912e472e54738f60a67b Mon Sep 17 00:00:00 2001 From: Archie Jaskowicz Date: Thu, 11 Jul 2024 13:25:22 +0100 Subject: [PATCH] fix: unit tests are now built statically when BUILD_SHARED_LIBS is off (#1193) --- library/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index ba47b77cf7..e0eac6632c 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -111,8 +111,6 @@ if(NOT BUILD_SHARED_LIBS) endif() endif() -include("${CMAKE_CURRENT_SOURCE_DIR}/../cmake/colour.cmake") - if (BUILD_VOICE_SUPPORT) if (MINGW OR NOT WIN32) find_package(PkgConfig QUIET) @@ -361,7 +359,11 @@ if (DPP_BUILD_TEST) if (MSVC) target_compile_options(${testname} PRIVATE /utf-8) endif() - target_link_libraries(${testname} PUBLIC ${modname}) + set (static_if_needed "") + if(NOT BUILD_SHARED_LIBS) + set (static_if_needed "-static") + endif() + target_link_libraries(${testname} PUBLIC ${modname} ${static_if_needed}) endif() endforeach() add_test(