diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index b98f2042d0..1d1e17f250 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -343,7 +343,7 @@ if(DPP_CORO) COMMAND php buildtools/make_struct.php "\\Dpp\\Generator\\CoroGenerator") endif() -if (DPP_BUILD_TEST) +if (DPP_BUILD_TEST AND BUILD_SHARED_LIBS) enable_testing(${CMAKE_CURRENT_SOURCE_DIR}/..) file(GLOB testnamelist "${CMAKE_CURRENT_SOURCE_DIR}/../src/*") foreach (fulltestname ${testnamelist}) @@ -361,11 +361,7 @@ if (DPP_BUILD_TEST) if (MSVC) target_compile_options(${testname} PRIVATE /utf-8) endif() - set (static_if_needed "") - if(NOT BUILD_SHARED_LIBS) - set (static_if_needed "-static") - endif() - target_link_libraries(${testname} PUBLIC ${modname} ${static_if_needed}) + target_link_libraries(${testname} PUBLIC ${modname}) endif() endforeach() add_test(