From 4b8b3970c5baec2a56fd9e07cfd65ea5ffdbf65a Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Thu, 29 Feb 2024 08:15:06 +0100 Subject: [PATCH] Fix export of OPJ_STATIC macro --- src/lib/openjp2/CMakeLists.txt | 6 +++--- src/lib/openjpip/CMakeLists.txt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/openjp2/CMakeLists.txt b/src/lib/openjp2/CMakeLists.txt index 99cf580a4..915a22982 100644 --- a/src/lib/openjp2/CMakeLists.txt +++ b/src/lib/openjp2/CMakeLists.txt @@ -83,12 +83,12 @@ endif() # Build the library if(WIN32) + add_library(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS}) if(BUILD_SHARED_LIBS) - add_definitions(-DOPJ_EXPORTS) + target_compile_definitions(${OPENJPEG_LIBRARY_NAME} PRIVATE OPJ_EXPORTS) else() - add_definitions(-DOPJ_STATIC) + target_compile_definitions(${OPENJPEG_LIBRARY_NAME} PUBLIC OPJ_STATIC) endif() - add_library(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS}) set(INSTALL_LIBS ${OPENJPEG_LIBRARY_NAME}) else() if(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS) diff --git a/src/lib/openjpip/CMakeLists.txt b/src/lib/openjpip/CMakeLists.txt index e9d819306..6584a744b 100644 --- a/src/lib/openjpip/CMakeLists.txt +++ b/src/lib/openjpip/CMakeLists.txt @@ -52,14 +52,14 @@ set(LOCAL_SRCS ) # Build the library +add_library(openjpip ${OPENJPIP_SRCS} ${LOCAL_SRCS}) if(WIN32) if(BUILD_SHARED_LIBS) - add_definitions(-DOPJ_EXPORTS) + target_compile_definitions(openjpip PRIVATE OPJ_EXPORTS) else() - add_definitions(-DOPJ_STATIC) + target_compile_definitions(openjpip PUBLIC OPJ_STATIC) endif() endif() -add_library(openjpip ${OPENJPIP_SRCS} ${LOCAL_SRCS}) set_target_properties(openjpip PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES}) target_compile_options(openjpip PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})