Skip to content

Commit

Permalink
fix: unit tests will no longer build at all if static build
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaskowicz1 committed Jul 8, 2024
1 parent ebdf0bd commit 066131d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand All @@ -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(
Expand Down

0 comments on commit 066131d

Please sign in to comment.