diff --git a/CMakeLists.txt b/CMakeLists.txt index 2188f97..93e6a34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,8 +124,6 @@ include(WindowsSupport) # Orthogonal features include(LibraryFeatures) -# pkg-config support -include(PkgConfig) # math.h/libm portability find_package(CMath REQUIRED) @@ -156,6 +154,8 @@ add_subdirectory(man) add_subdirectory(html) endif() +# pkg-config support +include(PkgConfig) message(STATUS "") message(STATUS "Libtiff is now configured for ${CMAKE_SYSTEM}") diff --git a/libtiff-4.pc.in b/libtiff-4.pc.in index abe75a6..8899725 100644 --- a/libtiff-4.pc.in +++ b/libtiff-4.pc.in @@ -5,7 +5,8 @@ includedir=@includedir@ Name: libtiff Description: Tag Image File Format (TIFF) library. -Version: @VERSION@ +Version: @LIBTIFF_VERSION_FULL@ Libs: -L${libdir} -ltiff Libs.private: @tiff_libs_private@ Cflags: -I${includedir} +Requires.private: @tiff_requires_private@ diff --git a/libtiff/CMakeLists.txt b/libtiff/CMakeLists.txt index db5f140..6db71ee 100755 --- a/libtiff/CMakeLists.txt +++ b/libtiff/CMakeLists.txt @@ -106,14 +106,19 @@ target_include_directories(tiff ${TIFF_INCLUDES} ) +set(tiff_libs_private "") +set(tiff_requires_private "") + if(ZIP_SUPPORT) target_link_libraries(tiff PRIVATE ZLIB::ZLIB) + string(APPEND tiff_requires_private " zlib") endif() if(ZIP_SUPPORT AND LIBDEFLATE_SUPPORT) target_link_libraries(tiff PRIVATE Deflate::Deflate) endif() if(JPEG_SUPPORT) target_link_libraries(tiff PRIVATE JPEG::JPEG) + string(APPEND tiff_requires_private " libjpeg") if(JPEG_DUAL_MODE_8_12) target_include_directories(tiff PRIVATE ${JPEG12_INCLUDE_DIR}) target_link_libraries(tiff PRIVATE ${JPEG12_LIBRARIES}) @@ -127,14 +132,23 @@ if(LERC_SUPPORT) endif() if(LZMA_SUPPORT) target_link_libraries(tiff PRIVATE LibLZMA::LibLZMA) + string(APPEND tiff_requires_private " liblzma") endif() if(ZSTD_SUPPORT) target_link_libraries(tiff PRIVATE ZSTD::ZSTD) + string(APPEND tiff_requires_private " libzstd") endif() if(WEBP_SUPPORT) target_link_libraries(tiff PRIVATE WebP::WebP) + string(APPEND tiff_requires_private " libwebp") endif() target_link_libraries(tiff PRIVATE CMath::CMath) +if(CMath_LIBRARY) + string(APPEND tiff_libs_private " -lm") +endif() + +set(tiff_libs_private "${tiff_libs_private}" PARENT_SCOPE) +set(tiff_requires_private "${tiff_requires_private}" PARENT_SCOPE) set_target_properties(tiff PROPERTIES SOVERSION ${SO_COMPATVERSION}) if(NOT CYGWIN)