From 7836695fb82918db67b6b79d83d6d8f73ef423a8 Mon Sep 17 00:00:00 2001 From: Paul-Louis Ageneau Date: Tue, 22 Oct 2024 22:27:39 +0200 Subject: [PATCH] CMake: Fix JUICE_STATIC define when BUILD_SHARED_LIBS=OFF --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e240cc9..6010d728 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,7 +108,6 @@ target_include_directories(juice-static PUBLIC target_include_directories(juice-static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/juice) target_include_directories(juice-static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) target_compile_definitions(juice-static PRIVATE $<$:RELEASE=1>) -target_compile_definitions(juice-static PUBLIC JUICE_STATIC) target_link_libraries(juice-static PRIVATE Threads::Threads) if(WIN32) @@ -185,7 +184,11 @@ install(FILES set_target_properties(juice PROPERTIES C_VISIBILITY_PRESET hidden) target_compile_definitions(juice PRIVATE JUICE_EXPORTS) +if (NOT BUILD_SHARED_LIBS) + target_compile_definitions(juice PUBLIC JUICE_STATIC) +endif() target_compile_definitions(juice-static PRIVATE JUICE_EXPORTS) +target_compile_definitions(juice-static PUBLIC JUICE_STATIC) if(NOT MSVC) target_compile_options(juice PRIVATE -Wall -Wextra)