Build: make sure that -DBUILD_SHARED_LIBS:bool=off is honoured to build only the static lib (#1019)
This commit is contained in:
parent
28094e1ebf
commit
3dfc6ca2bc
|
@ -173,6 +173,7 @@ configure_file(
|
|||
#-----------------------------------------------------------------------------
|
||||
# OpenJPEG build configuration options.
|
||||
option(BUILD_SHARED_LIBS "Build OpenJPEG shared library and link executables against it." ON)
|
||||
option(BUILD_STATIC_LIBS "Build OpenJPEG static library." ON)
|
||||
set (EXECUTABLE_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
|
||||
set (LIBRARY_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
|
||||
mark_as_advanced(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
|
||||
|
|
|
@ -91,11 +91,15 @@ if(WIN32)
|
|||
add_library(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS})
|
||||
set(INSTALL_LIBS ${OPENJPEG_LIBRARY_NAME})
|
||||
else()
|
||||
# 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)
|
||||
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)
|
||||
else()
|
||||
add_library(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
|
|
Loading…
Reference in New Issue