Added option to disable installation

This commit is contained in:
Egor Yusov 2019-09-17 23:24:14 -07:00 committed by assiduous
parent e3f07dcc07
commit ca5e069703
3 changed files with 37 additions and 28 deletions

View File

@ -107,6 +107,7 @@ endif()
# Install directories # Install directories
# Build DOCUMENTATION (not in ALL target and only if Doxygen is found) # Build DOCUMENTATION (not in ALL target and only if Doxygen is found)
option(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF) option(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)
option(OPENJPEG_SKIP_INSTALL "Disable openjpeg installation" ON)
string(TOLOWER ${PROJECT_NAME} projectname) string(TOLOWER ${PROJECT_NAME} projectname)
set(OPENJPEG_INSTALL_SUBDIR "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}") set(OPENJPEG_INSTALL_SUBDIR "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
@ -334,16 +335,18 @@ if(BUILD_TESTING)
endif() endif()
endif() endif()
#----------------------------------------------------------------------------- if(NOT OPENJPEG_SKIP_INSTALL)
# install all targets referenced as OPENJPEGTargets #-----------------------------------------------------------------------------
install(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}) # install all targets referenced as OPENJPEGTargets
configure_file( ${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake/OpenJPEGConfig.cmake.in install(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
${${OPENJPEG_NAMESPACE}_BINARY_DIR}/OpenJPEGConfig.cmake configure_file( ${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake/OpenJPEGConfig.cmake.in
@ONLY ${${OPENJPEG_NAMESPACE}_BINARY_DIR}/OpenJPEGConfig.cmake
) @ONLY
install( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake )
DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR} install( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
) DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
)
endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# install CHANGES and LICENSE # install CHANGES and LICENSE

View File

@ -65,10 +65,12 @@ foreach(exe opj_decompress opj_compress opj_dump)
endif() endif()
endif() endif()
# Install exe # Install exe
install(TARGETS ${exe} if(NOT OPENJPEG_SKIP_INSTALL)
EXPORT OpenJPEGTargets install(TARGETS ${exe}
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications EXPORT OpenJPEGTargets
) DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
endif()
if(OPJ_USE_DSYMUTIL) if(OPJ_USE_DSYMUTIL)
add_custom_command(TARGET ${exe} POST_BUILD add_custom_command(TARGET ${exe} POST_BUILD
COMMAND "dsymutil" "$<TARGET_FILE:${exe}>" COMMAND "dsymutil" "$<TARGET_FILE:${exe}>"

View File

@ -1,8 +1,10 @@
include_regular_expression("^.*$") include_regular_expression("^.*$")
# #
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/opj_config.h if(NOT OPENJPEG_SKIP_INSTALL)
DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/opj_config.h
DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers)
endif()
include_directories( include_directories(
${${OPENJPEG_NAMESPACE}_BINARY_DIR}/src/lib/openjp2 # opj_config.h and opj_config_private.h ${${OPENJPEG_NAMESPACE}_BINARY_DIR}/src/lib/openjp2 # opj_config.h and opj_config_private.h
@ -114,18 +116,20 @@ if(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.12")
target_compile_options(${OPENJPEG_LIBRARY_NAME} PRIVATE ${OPENJP2_COMPILE_OPTIONS}) target_compile_options(${OPENJPEG_LIBRARY_NAME} PRIVATE ${OPENJP2_COMPILE_OPTIONS})
endif() endif()
# Install library if(NOT OPENJPEG_SKIP_INSTALL)
install(TARGETS ${INSTALL_LIBS} # Install library
EXPORT OpenJPEGTargets install(TARGETS ${INSTALL_LIBS}
RUNTIME DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications EXPORT OpenJPEGTargets
LIBRARY DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries RUNTIME DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
ARCHIVE DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries LIBRARY DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
) ARCHIVE DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
)
# Install includes files # Install includes files
install(FILES openjpeg.h opj_stdint.h install(FILES openjpeg.h opj_stdint.h
DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers
) )
endif()
if(BUILD_DOC) if(BUILD_DOC)
# install man page of the library # install man page of the library