diff options
author | Roger Leigh <rleigh@codelibre.net> | 2021-02-07 23:18:29 +0000 |
---|---|---|
committer | Roger Leigh <rleigh@codelibre.net> | 2021-02-13 12:24:53 +0000 |
commit | 6f509b0cd748829acb4dc32b22e87c14e17ceb87 (patch) | |
tree | 34a8dd54ccff12c19525077910e3ca25a646345b | |
parent | 2da1c03be20cd0d028d17821e86ddc29aab37035 (diff) | |
download | libtiff-git-6f509b0cd748829acb4dc32b22e87c14e17ceb87.tar.gz |
cmake: Use imported targets for WebP
-rw-r--r-- | CMakeLists.txt | 20 | ||||
-rwxr-xr-x | libtiff/CMakeLists.txt | 3 |
2 files changed, 6 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c3eef32e..aad36f97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,17 +112,9 @@ include(ZSTDCodec) # libwebp set(WEBP_SUPPORT FALSE) -find_path(WEBP_INCLUDE_DIR webp/decode.h) -find_library(WEBP_LIBRARY NAMES webp) -if (WEBP_INCLUDE_DIR AND WEBP_LIBRARY) - set(WEBP_LIBRARIES ${WEBP_LIBRARY}) - set(WEBP_FOUND TRUE) - message(STATUS "Found WEBP library: ${WEBP_LIBRARY}") -else() - set(WEBP_FOUND FALSE) -endif() -option(webp "use libwebp (required for WEBP compression)" ${WEBP_FOUND}) -if (webp AND WEBP_FOUND) +find_package(WebP) +option(webp "use libwebp (required for WEBP compression)" ${WebP_FOUND}) +if (webp AND WebP_FOUND) set(WEBP_SUPPORT TRUE) endif() @@ -220,9 +212,6 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libtiff-4.pc if(JPEG12_INCLUDE_DIR) list(APPEND TIFF_INCLUDES ${JPEG12_INCLUDE_DIR}) endif() -if(WEBP_INCLUDE_DIR) - list(APPEND TIFF_INCLUDES ${WEBP_INCLUDE_DIR}) -endif() # Libraries required by libtiff set(TIFF_LIBRARY_DEPS) @@ -232,9 +221,6 @@ endif() if(JPEG12_LIBRARIES) list(APPEND TIFF_LIBRARY_DEPS ${JPEG12_LIBRARIES}) endif() -if(WEBP_LIBRARIES) - list(APPEND TIFF_LIBRARY_DEPS ${WEBP_LIBRARIES}) -endif() report_values(TIFF_INCLUDES TIFF_LIBRARY_DEPS) diff --git a/libtiff/CMakeLists.txt b/libtiff/CMakeLists.txt index 986a97d8..4a644050 100755 --- a/libtiff/CMakeLists.txt +++ b/libtiff/CMakeLists.txt @@ -123,6 +123,9 @@ endif() if(ZSTD_SUPPORT) target_link_libraries(tiff PRIVATE ZSTD::ZSTD) endif() +if(WEBP_SUPPORT) + target_link_libraries(tiff PRIVATE WebP::WebP) +endif() target_link_libraries(tiff PRIVATE ${TIFF_LIBRARY_DEPS}) set_target_properties(tiff PROPERTIES SOVERSION ${SO_COMPATVERSION}) if(NOT CYGWIN) |