[trunk] properly handle pkg-config on non-UNIX hosts

Fixes issue 340
This commit is contained in:
Mathieu Malaterre 2014-04-28 07:34:26 +00:00
parent 763214f7c0
commit 997758f91c
3 changed files with 18 additions and 2 deletions

View File

@ -95,6 +95,8 @@ endif()
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Install directories # 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) 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}")
@ -119,6 +121,7 @@ if(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
set(OPENJPEG_INSTALL_INCLUDE_DIR "include/${OPENJPEG_INSTALL_SUBDIR}") set(OPENJPEG_INSTALL_INCLUDE_DIR "include/${OPENJPEG_INSTALL_SUBDIR}")
endif() endif()
if(BUILD_DOC)
if(NOT OPENJPEG_INSTALL_MAN_DIR) if(NOT OPENJPEG_INSTALL_MAN_DIR)
set(OPENJPEG_INSTALL_MAN_DIR "share/man/") set(OPENJPEG_INSTALL_MAN_DIR "share/man/")
endif() endif()
@ -126,6 +129,7 @@ endif()
if(NOT OPENJPEG_INSTALL_DOC_DIR) if(NOT OPENJPEG_INSTALL_DOC_DIR)
set(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}") set(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}")
endif() endif()
endif()
if(NOT OPENJPEG_INSTALL_JNI_DIR) if(NOT OPENJPEG_INSTALL_JNI_DIR)
if(WIN32) if(WIN32)
@ -265,8 +269,7 @@ configure_file(
) )
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Build DOCUMENTATION (not in ALL target and only if Doxygen is found) # build documentation in doc subdir:
option(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)
if(BUILD_DOC) if(BUILD_DOC)
add_subdirectory(doc) add_subdirectory(doc)
endif() endif()
@ -308,16 +311,25 @@ install( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# install CHANGES and LICENSE # install CHANGES and LICENSE
if(BUILD_DOC)
if(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES) if(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES)
install(FILES CHANGES DESTINATION ${OPENJPEG_INSTALL_DOC_DIR}) install(FILES CHANGES DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
endif() endif()
install(FILES LICENSE DESTINATION ${OPENJPEG_INSTALL_DOC_DIR}) install(FILES LICENSE DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
endif()
include (cmake/OpenJPEGCPack.cmake) include (cmake/OpenJPEGCPack.cmake)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# pkgconfig support # pkgconfig support
# enabled by default on Unix, disabled by default on other platforms
if(UNIX) 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) # install in lib and not share (see multi-arch note above)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/libopenjp2.pc.cmake.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/libopenjp2.pc.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libopenjp2.pc @ONLY) ${CMAKE_CURRENT_BINARY_DIR}/libopenjp2.pc @ONLY)

View File

@ -52,6 +52,7 @@ foreach(exe opj_decompress opj_compress opj_dump)
) )
endforeach() endforeach()
if(BUILD_DOC)
# Install man pages # Install man pages
install( install(
FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_compress.1 FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_compress.1
@ -59,3 +60,4 @@ install(
${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_dump.1 ${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_dump.1
DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man1) DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man1)
# #
endif()

View File

@ -68,10 +68,12 @@ install(FILES openjpeg.h opj_stdint.h
DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers
) )
if(BUILD_DOC)
# install man page of the library # install man page of the library
install( install(
FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man3/libopenjp2.3 FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man3/libopenjp2.3
DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man3) DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man3)
endif()
# internal utilities to generate t1_luts.h (part of the jp2 lib) # internal utilities to generate t1_luts.h (part of the jp2 lib)
# no need to install: # no need to install: