diff --git a/src/sail-codecs/webp/CMakeLists.txt b/src/sail-codecs/webp/CMakeLists.txt index 64d31e5a..40c33084 100644 --- a/src/sail-codecs/webp/CMakeLists.txt +++ b/src/sail-codecs/webp/CMakeLists.txt @@ -1,28 +1,20 @@ -find_library(WEBP_RELEASE_LIBRARY NAMES webp ${SAIL_CODEC_WEBP_REQUIRED_OPTION}) -find_library(WEBP_DEBUG_LIBRARY NAMES webpd webp ${SAIL_CODEC_WEBP_REQUIRED_OPTION}) -find_library(WEBP_DEMUX_RELEASE_LIBRARY NAMES webpdemux ${SAIL_CODEC_WEBP_REQUIRED_OPTION}) -find_library(WEBP_DEMUX_DEBUG_LIBRARY NAMES webpdemuxd webpdemux ${SAIL_CODEC_WEBP_REQUIRED_OPTION}) -find_path(WEBP_INCLUDE_DIRS webp/decode.h ${SAIL_CODEC_WEBP_REQUIRED_OPTION}) +find_package(WebP CONFIG ${SAIL_CODEC_WEBP_REQUIRED_OPTION}) -if ((NOT WEBP_RELEASE_LIBRARY AND NOT WEBP_DEBUG_LIBRARY) OR (NOT WEBP_DEMUX_RELEASE_LIBRARY AND NOT WEBP_DEMUX_DEBUG_LIBRARY) OR NOT WEBP_INCLUDE_DIRS) +if (NOT WebP_FOUND) return() endif() # This will add the following CMake rules to the CMake config for static builds so a client # application links against the required dependencies: # -# find_library(webp_RELEASE_LIBRARY NAMES webp) -# find_library(webp_DEBUG_LIBRARY NAMES webpd webp) -# set_property(TARGET SAIL::sail-codecs APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<$:${webp_RELEASE_LIBRARY}> $<$:${webp_DEBUG_LIBRARY}>) +# find_dependency(LIBWEBP REQUIRED) +# set_property(TARGET SAIL::sail-codecs APPEND PROPERTY INTERFACE_LINK_LIBRARIES WebP::webp WebP::webpdecoder WebP::webpdemux) # -# Same to webpdemux. -# -set(SAIL_CODECS_FIND_DEPENDENCIES ${SAIL_CODECS_FIND_DEPENDENCIES} "find_library,webp,webpd" "find_library,webpdemux,webpdemuxd" PARENT_SCOPE) +set(SAIL_CODECS_FIND_DEPENDENCIES ${SAIL_CODECS_FIND_DEPENDENCIES} "find_dependency,WEBP,WebP::webp WebP::webpdecoder WebP::webpdemux" PARENT_SCOPE) # Common codec configuration # sail_codec(NAME webp SOURCES helpers.h helpers.c webp.c ICON webp.png - DEPENDENCY_INCLUDE_DIRS ${WEBP_INCLUDE_DIRS} - DEPENDENCY_LIBS optimized ${WEBP_RELEASE_LIBRARY} debug ${WEBP_DEBUG_LIBRARY} optimized ${WEBP_DEMUX_RELEASE_LIBRARY} debug ${WEBP_DEMUX_DEBUG_LIBRARY}) + DEPENDENCY_LIBS WebP::webp WebP::webpdecoder WebP::webpdemux)