tomato/external/libwebp/CMakeLists.txt
Green Sky 5bd76bb2be
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousDelivery / windows (push) Has been cancelled
ContinuousDelivery / windows-asan (push) Has been cancelled
ContinuousDelivery / dumpsyms (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
ContinuousIntegration / linux (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled
try pkg-config to find libwebp
2025-04-08 20:59:19 +02:00

76 lines
2.4 KiB
CMake

cmake_minimum_required(VERSION 3.16...3.24 FATAL_ERROR)
include(FetchContent)
option(TOMATO_DEP_LIBWEBP_USE_SYSTEM "Prefer system provided libwebp" OFF)
if (TOMATO_DEP_LIBWEBP_USE_SYSTEM)
if (NOT TARGET WebP::libwebpmux)
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
find_package(WebP CONFIG GLOBAL QUIET COMPONENTS webp webpdemux libwebpmux)
endif()
#if (NOT TARGET libwebp)
# 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()
if (TARGET WebP::webpdemux)
message(STATUS "found WebP::webpdemux")
endif()
if (TARGET WebP::libwebpmux)
message(STATUS "found WebP::libwebpmux")
endif()
if (TARGET WebP::libwebpmux)
message(STATUS "found system libwebp")
else()
message(STATUS "system libwebp not found")
endif()
endif()
if (NOT TARGET WebP::libwebpmux)
set(WEBP_LINK_STATIC ON CACHE BOOL "" FORCE)
set(WEBP_BUILD_ANIM_UTILS OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_CWEBP OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_DWEBP OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_GIF2WEBP OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_IMG2WEBP OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_VWEBP OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_WEBPINFO OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_LIBWEBPMUX ON CACHE BOOL "" FORCE)
set(WEBP_BUILD_WEBPMUX OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_EXTRAS OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_WEBP_JS OFF CACHE BOOL "" FORCE)
set(WEBP_USE_THREAD ON CACHE BOOL "" FORCE)
FetchContent_Declare(libwebp
GIT_REPOSITORY https://github.com/webmproject/libwebp
GIT_TAG v1.5.0
FIND_PACKAGE_ARGS
)
FetchContent_MakeAvailable(libwebp)
add_library(WebP::webp ALIAS webp)
add_library(WebP::webpdemux ALIAS webpdemux)
add_library(WebP::libwebpmux ALIAS libwebpmux)
endif()