From 997758f91cfc2620ce23dba009ddb38fe4ff2257 Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Mon, 28 Apr 2014 07:34:26 +0000 Subject: [PATCH] [trunk] properly handle pkg-config on non-UNIX hosts Fixes issue 340 --- CMakeLists.txt | 16 ++++++++++++++-- src/bin/jp2/CMakeLists.txt | 2 ++ src/lib/openjp2/CMakeLists.txt | 2 ++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a37d3ead..229da1e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,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 +121,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 +129,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) @@ -265,8 +269,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 +311,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) diff --git a/src/bin/jp2/CMakeLists.txt b/src/bin/jp2/CMakeLists.txt index 43746317..1c2ef39c 100644 --- a/src/bin/jp2/CMakeLists.txt +++ b/src/bin/jp2/CMakeLists.txt @@ -52,6 +52,7 @@ foreach(exe opj_decompress opj_compress opj_dump) ) endforeach() +if(BUILD_DOC) # Install man pages install( FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_compress.1 @@ -59,3 +60,4 @@ install( ${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_dump.1 DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man1) # +endif() diff --git a/src/lib/openjp2/CMakeLists.txt b/src/lib/openjp2/CMakeLists.txt index 5c87f297..fcf60ecf 100644 --- a/src/lib/openjp2/CMakeLists.txt +++ b/src/lib/openjp2/CMakeLists.txt @@ -68,10 +68,12 @@ install(FILES openjpeg.h opj_stdint.h DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers ) +if(BUILD_DOC) # install man page of the library install( FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man3/libopenjp2.3 DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man3) +endif() # internal utilities to generate t1_luts.h (part of the jp2 lib) # no need to install: