diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake index 91084fa09392..b9a613548191 100644 --- a/cmake/OpenCVFindLibsGrfmt.cmake +++ b/cmake/OpenCVFindLibsGrfmt.cmake @@ -131,10 +131,27 @@ if(WITH_WEBP) if(BUILD_WEBP) ocv_clear_vars(WEBP_FOUND WEBP_LIBRARY WEBP_LIBRARIES WEBP_INCLUDE_DIR) else() + if(HUNTER_ENABLED) + hunter_add_package(WebP) + find_package(WebP CONFIG REQUIRED) + set(WEBP_FOUND TRUE) + set(HAVE_WEBP 1) + set(WEBP_LIBRARY WebP::webp) + set(WEBP_LIBRARIES ${WEBP_LIBRARY}) + + get_target_property( + WEBP_INCLUDE_DIR + WebP::webp + INTERFACE_INCLUDE_DIRECTORIES + ) + else() + include(cmake/OpenCVFindWebP.cmake) if(WEBP_FOUND) set(HAVE_WEBP 1) endif() + + endif() endif() endif() diff --git a/cmake/templates/OpenCVConfig.cmake.in b/cmake/templates/OpenCVConfig.cmake.in index 706b07196f58..bdf0ec3beebb 100644 --- a/cmake/templates/OpenCVConfig.cmake.in +++ b/cmake/templates/OpenCVConfig.cmake.in @@ -336,6 +336,10 @@ if("@JASPER_FOUND@") find_dependency(jasper CONFIG) endif() +if("@WEBP_FOUND@") + find_dependency(WebP CONFIG) +endif() + # AWP: Qt5 dependencies -- start if("@Qt5Core_FOUND@") find_dependency(Qt5Core)