X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=CMakeLists.txt;h=79f66c357ba03db6bee622bb5be7909077a91951;hb=refs%2Fpull%2F548%2Fhead;hp=a37d3eadb9641d1ebcbf5e992ca26bc61fef47a5;hpb=1adf89d5d2b3a40bf4f0e996456c1a98fc08bb93;p=openjpeg.git diff --git a/CMakeLists.txt b/CMakeLists.txt index a37d3ead..79f66c35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,9 @@ cmake_minimum_required(VERSION 2.8.2) if(COMMAND CMAKE_POLICY) cmake_policy(SET CMP0003 NEW) + if (NOT (${CMAKE_VERSION} VERSION_LESS 3.0)) + cmake_policy(SET CMP0042 NEW) + endif() endif() if(NOT OPENJPEG_NAMESPACE) @@ -95,6 +98,8 @@ endif() # -------------------------------------------------------------------------- # Install directories +# Build DOCUMENTATION (not in ALL target and only if Doxygen is found) +option(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF) string(TOLOWER ${PROJECT_NAME} projectname) set(OPENJPEG_INSTALL_SUBDIR "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}") @@ -119,6 +124,7 @@ if(NOT OPENJPEG_INSTALL_INCLUDE_DIR) set(OPENJPEG_INSTALL_INCLUDE_DIR "include/${OPENJPEG_INSTALL_SUBDIR}") endif() +if(BUILD_DOC) if(NOT OPENJPEG_INSTALL_MAN_DIR) set(OPENJPEG_INSTALL_MAN_DIR "share/man/") endif() @@ -126,6 +132,7 @@ endif() if(NOT OPENJPEG_INSTALL_DOC_DIR) set(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}") endif() +endif() if(NOT OPENJPEG_INSTALL_JNI_DIR) if(WIN32) @@ -142,6 +149,11 @@ if(NOT OPENJPEG_INSTALL_PACKAGE_DIR) set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}") endif() +if (APPLE) + list(APPEND OPENJPEG_LIBRARY_PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_LIB_DIR}") + option(OPJ_USE_DSYMUTIL "Call dsymutil on binaries after build." OFF) +endif() + #----------------------------------------------------------------------------- # Big endian test: include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake) @@ -265,8 +277,7 @@ configure_file( ) #----------------------------------------------------------------------------- -# Build DOCUMENTATION (not in ALL target and only if Doxygen is found) -option(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF) +# build documentation in doc subdir: if(BUILD_DOC) add_subdirectory(doc) endif() @@ -308,16 +319,25 @@ install( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake #----------------------------------------------------------------------------- # install CHANGES and LICENSE +if(BUILD_DOC) if(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES) install(FILES CHANGES DESTINATION ${OPENJPEG_INSTALL_DOC_DIR}) endif() + install(FILES LICENSE DESTINATION ${OPENJPEG_INSTALL_DOC_DIR}) +endif() include (cmake/OpenJPEGCPack.cmake) #----------------------------------------------------------------------------- # pkgconfig support +# enabled by default on Unix, disabled by default on other platforms if(UNIX) + option(BUILD_PKGCONFIG_FILES "Build and install pkg-config files" ON) +else() + option(BUILD_PKGCONFIG_FILES "Build and install pkg-config files" OFF) +endif() +if(BUILD_PKGCONFIG_FILES) # install in lib and not share (see multi-arch note above) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/libopenjp2.pc.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/libopenjp2.pc @ONLY)