summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindGpgme.cmake
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-05-08 09:37:32 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-05-08 09:37:32 +0200
commit2940dd75d550270d369bdf41418268d5956060b8 (patch)
treea60dcfa4e50acb99f8e739b944d38279ebef5ef0 /cmake/modules/FindGpgme.cmake
parent68cbe64765d26f28d5555fd09fc710f91ea81187 (diff)
downloadkube-2940dd75d550270d369bdf41418268d5956060b8.tar.gz
kube-2940dd75d550270d369bdf41418268d5956060b8.zip
Make use of interface include directories and link libraries.
Instead of manually specifying the libraries to link against and the include directories to include we'd much rather have a single target to link against. find_package already defines the Gpgme target for some reason, which seems like a waste, but with the lowercase gpgme target we can work around that problem.
Diffstat (limited to 'cmake/modules/FindGpgme.cmake')
-rw-r--r--cmake/modules/FindGpgme.cmake17
1 files changed, 15 insertions, 2 deletions
diff --git a/cmake/modules/FindGpgme.cmake b/cmake/modules/FindGpgme.cmake
index ea4a750d..cb1b19b7 100644
--- a/cmake/modules/FindGpgme.cmake
+++ b/cmake/modules/FindGpgme.cmake
@@ -1,5 +1,18 @@
1find_path(GPGME_INCLUDE_DIR NAMES gpgme.h) 1find_path(GPGME_INCLUDE_DIR NAMES gpgme.h)
2find_library(GPGME_LIBRARIES NAMES gpgme) 2find_path(GPGERROR_INCLUDE_DIR NAMES gpg-error.h)
3find_library(GPGME_LIBRARY NAMES gpgme)
4find_library(GPGERROR_LIBRARY NAMES gpg-error)
3 5
4include(FindPackageHandleStandardArgs) 6include(FindPackageHandleStandardArgs)
5find_package_handle_standard_args(GPGME DEFAULT_MSG GPGME_INCLUDE_DIR GPGME_LIBRARIES) 7find_package_handle_standard_args(GPGME DEFAULT_MSG GPGME_INCLUDE_DIR GPGERROR_INCLUDE_DIR GPGME_LIBRARY GPGERROR_LIBRARY)
8
9mark_as_advanced(GPGME_INCLUDE_DIR GPGME_LIBRARY GPGME_INCLUDE_DIR GPGME_LIBRARY)
10
11set(GPGME_LIBRARIES ${GPGME_LIBRARY} ${GPGERROR_LIBRARY})
12set(GPGME_INCLUDE_DIRS ${GPGME_INCLUDE_DIR} ${GPGERROR_INCLUDE_DIR})
13
14if (NOT ${gpgme})
15 add_library(gpgme INTERFACE)
16 target_link_libraries(gpgme INTERFACE ${GPGME_LIBRARIES})
17 target_include_directories(gpgme INTERFACE ${GPGME_INCLUDE_DIRS})
18endif()