From 5bd76bb2be35cb443619d7e819ce391e748b1471 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Tue, 8 Apr 2025 20:59:19 +0200 Subject: [PATCH] try pkg-config to find libwebp --- external/libwebp/CMakeLists.txt | 15 +++++++++++++++ src/CMakeLists.txt | 1 + 2 files changed, 16 insertions(+) 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