summaryrefslogtreecommitdiff
path: root/user/kgpg/find-gpgme-with-pkg-config-first.patch
blob: 0073f5731d8941fbd07afcf1323dc71d6f59d6ff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From 7d6023e1a9d7899f618b1490f2907eff8efe48a5 Mon Sep 17 00:00:00 2001
From: Rolf Eike Beer <kde@opensource.sf-tec.de>
Date: Thu, 22 Dec 2022 16:19:07 +0100
Subject: [PATCH] CMake: search for gpgme with pkg-config first

FIXES: 461720
---
 cmake/FindGpgme.cmake | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/cmake/FindGpgme.cmake b/cmake/FindGpgme.cmake
index e3e177f2..81117a9b 100644
--- a/cmake/FindGpgme.cmake
+++ b/cmake/FindGpgme.cmake
@@ -27,6 +27,8 @@
 # Any changes here likely apply there, too.
 #
 
+find_package(PkgConfig)
+
 #if this is built-in, please replace, if it isn't, export into a MacroToBool.cmake of it's own
 macro( macro_bool_to_bool FOUND_VAR )
   foreach( _current_VAR ${ARGN} )
@@ -49,8 +51,14 @@ MACRO(MACRO_BOOL_TO_01 FOUND_VAR )
    ENDFOREACH(_current_VAR)
 ENDMACRO(MACRO_BOOL_TO_01)
 
+pkg_search_module(PC_GPGME gpgme)
 
-if ( WIN32 )
+if (PC_GPGME_FOUND)
+  set(GPGME_INCLUDES ${PC_GPGME_INCLUDE_DIRS})
+  set(GPGME_LIBRARIES ${PC_GPGME_LINK_LIBRARIES})
+  set(GPGME_VERSION ${PC_GPGME_VERSION})
+  set(GPGME_LIBRARY_DIR ${PC_GPGME_LIBRARY_DIR})
+elseif ( WIN32 )
 
   # On Windows, we don't have a gpgme-config script, so we need to
   # look for the stuff ourselves:
@@ -353,20 +361,11 @@ foreach(_currentFlavour vanilla glib qt pth pthread)
    endif()
 endforeach()
 
-if ( NOT Gpgme_FIND_QUIETLY )
-
-  if ( GPGME_FOUND )
-    message( STATUS "Usable gpgme flavors found: ${_gpgme_flavours}" )
-  else()
-    message( STATUS "No usable gpgme flavors found." )
-  endif()
-
-endif()
-
-if ( Gpgme_FIND_REQUIRED AND NOT GPGME_FOUND )
-  message( FATAL_ERROR "Did not find GPGME" )
-endif()
-
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Gpgme
+                                  REQUIRED_VARS GPGME_LIBRARIES
+                                  VERSION_VAR GPGME_VERSION
+                                  )
 
 if ( WIN32 )
   set( _gpgme_homepage "https://www.gpg4win.org" )
-- 
GitLab