diff --git a/external/libwebp/CMakeLists.txt b/external/libwebp/CMakeLists.txt index b118cbe..edabd0b 100644 --- a/external/libwebp/CMakeLists.txt +++ b/external/libwebp/CMakeLists.txt @@ -14,6 +14,21 @@ if (TOMATO_DEP_LIBWEBP_USE_SYSTEM) # find_package(WebP GLOBAL) #endif() + if (NOT TARGET WebP::libwebpmux) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(libwebp_PKG IMPORTED_TARGET GLOBAL libwebp) + pkg_check_modules(libwebpdemux_PKG IMPORTED_TARGET GLOBAL libwebpdemux) + pkg_check_modules(libwebpmux_PKG IMPORTED_TARGET GLOBAL libwebpmux) + + if (TARGET PkgConfig::libwebp_PKG AND TARGET PkgConfig::libwebpdemux_PKG AND TARGET PkgConfig::libwebpmux_PKG) + add_library(WebP::webp ALIAS PkgConfig::libwebp_PKG) + add_library(WebP::webpdemux ALIAS PkgConfig::libwebpdemux_PKG) + add_library(WebP::libwebpmux ALIAS PkgConfig::libwebpmux_PKG) + endif() + endif() + endif() + if (TARGET WebP::webp) message(STATUS "found WebP::webp") endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d2f9c0a..0df7589 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -194,6 +194,7 @@ target_link_libraries(tomato PUBLIC stb_image stb_image_write + WebP::webp WebP::webpdemux WebP::libwebpmux # the f why (needed for anim encode) qoi