summaryrefslogtreecommitdiff
path: root/cmake/FindWrapWebP.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/FindWrapWebP.cmake')
-rw-r--r--cmake/FindWrapWebP.cmake7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmake/FindWrapWebP.cmake b/cmake/FindWrapWebP.cmake
index b546529..487c18b 100644
--- a/cmake/FindWrapWebP.cmake
+++ b/cmake/FindWrapWebP.cmake
@@ -5,6 +5,13 @@
# So try config files first, and then use the regular find_library / find_path dance with pkg-config
# paths as hints.
+# We can't create the same interface imported target multiple times, CMake will complain if we do
+# that. This can happen if the find_package call is done in multiple different subdirectories.
+if(TARGET WrapWebP::WrapWebP)
+ set(WrapWebP_FOUND TRUE)
+ return()
+endif()
+
find_package(WebP QUIET)
if(TARGET WebP::webp AND TARGET WebP::webpdemux AND TARGET WebP::libwebpmux)
set(WrapWebP_FOUND ON)