From 2a0092cf7568f7e87385af78242e8ed6806d1810 Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Thu, 30 Jan 2025 16:18:48 -0500 Subject: [PATCH] Update OpenCVFindWebP.cmake with sturkmen72's suggestion @sturkmen72 feel free to fold into https://github.com/opencv/opencv/pull/26762 but I would just like a dedicated patch to try. --- cmake/OpenCVFindWebP.cmake | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cmake/OpenCVFindWebP.cmake b/cmake/OpenCVFindWebP.cmake index 3af0908cbb..d6c707cee0 100644 --- a/cmake/OpenCVFindWebP.cmake +++ b/cmake/OpenCVFindWebP.cmake @@ -10,10 +10,17 @@ # Look for the header file. -FIND_PATH(WEBP_INCLUDE_DIR NAMES webp/decode.h) +unset(WEBP_FOUND) -if(NOT WEBP_INCLUDE_DIR) - unset(WEBP_FOUND) +find_package(WebP QUIET) + +if(TARGET WebP::webp AND TARGET WebP::webpdemux AND TARGET WebP::libwebpmux) + MARK_AS_ADVANCED(WEBP_INCLUDE_DIR) + MARK_AS_ADVANCED(WEBP_LIBRARY) + + SET(WEBP_FOUND TRUE) + SET(WEBP_LIBRARY WebP) + SET(WEBP_INCLUDE_DIR) else() MARK_AS_ADVANCED(WEBP_INCLUDE_DIR)