[graphics/krita] cmake/modules: Fix WebP find module for old pkg-config based versions

L. E. Segovia null at kde.org
Sat Apr 2 01:43:21 BST 2022


Git commit d99f8c3a50a74195b0d82cb00dfc7b4ae13de2dd by L. E. Segovia.
Committed on 02/04/2022 at 00:43.
Pushed by lsegovia into branch 'master'.

Fix WebP find module for old pkg-config based versions

These make available the version, but WebKit blocks them outright
instead of letting CMake manage them.

Let's also fix the fact that modules are looked up and created without
checking if CMake considers WebP to be found.

CCMAIL: kimageshop at kde.org

M  +7    -10   cmake/modules/FindWebP.cmake

https://invent.kde.org/graphics/krita/commit/d99f8c3a50a74195b0d82cb00dfc7b4ae13de2dd

diff --git a/cmake/modules/FindWebP.cmake b/cmake/modules/FindWebP.cmake
index 71b257f8ed..e99363cc62 100644
--- a/cmake/modules/FindWebP.cmake
+++ b/cmake/modules/FindWebP.cmake
@@ -103,12 +103,8 @@ find_library(WebP_LIBRARY
 # There's nothing in the WebP headers that could be used to detect the exact
 # WebP version being used so don't attempt to do so. A version can only be found
 # through pkg-config
-if ("${WebP_FIND_VERSION}" VERSION_GREATER "${WebP_VERSION}")
-    if (WebP_VERSION)
-        message(FATAL_ERROR "Required version (" ${WebP_FIND_VERSION} ") is higher than found version (" ${WebP_VERSION} ")")
-    else ()
-        message(WARNING "Cannot determine WebP version without pkg-config")
-    endif ()
+if (NOT WebP_VERSION)
+    message(WARNING "Cannot determine WebP version without pkg-config")
 endif ()
 
 # Find components
@@ -207,6 +203,7 @@ find_package_handle_standard_args(WebP
     VERSION_VAR WebP_VERSION
 )
 
+if (WebP_FOUND)
 if (WebP_LIBRARY AND NOT TARGET WebP::webp)
     add_library(WebP::webp UNKNOWN IMPORTED GLOBAL)
     set_target_properties(WebP::webp PROPERTIES
@@ -251,7 +248,7 @@ mark_as_advanced(
     WebP_DECODER_LIBRARY
 )
 
-if (WebP_FOUND)
-    set(WebP_LIBRARIES ${WebP_LIBRARY} ${WebP_DEMUX_LIBRARY} ${WebP_MUX_LIBRARY} ${WebP_DECODER_LIBRARY})
-    set(WebP_INCLUDE_DIRS ${WebP_INCLUDE_DIR})
-endif ()
+set(WebP_LIBRARIES ${WebP_LIBRARY} ${WebP_DEMUX_LIBRARY} ${WebP_MUX_LIBRARY} ${WebP_DECODER_LIBRARY})
+set(WebP_INCLUDE_DIRS ${WebP_INCLUDE_DIR})
+
+endif()


More information about the kimageshop mailing list