summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Pastor <dg0yt@darc.de>2024-02-29 08:20:07 +0100
committerKai Pastor <dg0yt@darc.de>2024-02-29 08:20:07 +0100
commit51d1cd40f716d7a0d1b77e0a77796eb86b17136a (patch)
tree291ea6674117f0308146900c069a692283ea019c
parentea3f6cc28f56f0e785756bf7e272dbe51de2ff5d (diff)
Refactor build of both types of linkage
-rw-r--r--src/lib/openjp2/CMakeLists.txt22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/lib/openjp2/CMakeLists.txt b/src/lib/openjp2/CMakeLists.txt
index 915a2298..fd62335f 100644
--- a/src/lib/openjp2/CMakeLists.txt
+++ b/src/lib/openjp2/CMakeLists.txt
@@ -82,26 +82,20 @@ if(NOT WIN32 AND CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER MATCHES ".*mingw32
endif()
# Build the library
+add_library(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS})
+set(INSTALL_LIBS ${OPENJPEG_LIBRARY_NAME})
if(WIN32)
- add_library(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS})
if(BUILD_SHARED_LIBS)
target_compile_definitions(${OPENJPEG_LIBRARY_NAME} PRIVATE OPJ_EXPORTS)
else()
target_compile_definitions(${OPENJPEG_LIBRARY_NAME} PUBLIC OPJ_STATIC)
endif()
- set(INSTALL_LIBS ${OPENJPEG_LIBRARY_NAME})
-else()
- if(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
- # Builds both static and dynamic libs
- add_library(${OPENJPEG_LIBRARY_NAME} SHARED ${OPENJPEG_SRCS})
- add_library(openjp2_static STATIC ${OPENJPEG_SRCS})
- set_target_properties(openjp2_static PROPERTIES OUTPUT_NAME ${OPENJPEG_LIBRARY_NAME})
- set(INSTALL_LIBS ${OPENJPEG_LIBRARY_NAME} openjp2_static)
- target_include_directories(openjp2_static PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${OPENJPEG_INSTALL_SUBDIR}>)
- else()
- add_library(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS})
- set(INSTALL_LIBS ${OPENJPEG_LIBRARY_NAME})
- endif()
+elseif(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
+ # Builds both static and dynamic libs
+ add_library(openjp2_static STATIC ${OPENJPEG_SRCS})
+ set_target_properties(openjp2_static PROPERTIES OUTPUT_NAME ${OPENJPEG_LIBRARY_NAME})
+ list(APPEND INSTALL_LIBS openjp2_static)
+ target_include_directories(openjp2_static PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${OPENJPEG_INSTALL_SUBDIR}>)
endif()
target_include_directories(${OPENJPEG_LIBRARY_NAME} PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${OPENJPEG_INSTALL_SUBDIR}>)