summaryrefslogtreecommitdiff
path: root/CMake/FindGCRYPT.cmake
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2020-11-05 00:14:32 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2020-11-05 09:40:50 +0100
commit287912d6fc7ab0ab0b5f69a4a5260b5bf53121ba (patch)
tree63c19efefb8d6c07ee9038d3a6b9cbc35e9ea3cb /CMake/FindGCRYPT.cmake
parente748e07aaab817b3ada3a1b01bf80dbe52852952 (diff)
Rename CMake find_package helpers to avoid developer warnings
| CMake Warning (dev) at /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:273 (message): | The package name passed to `find_package_handle_standard_args` (Berkeley) | does not match the name of the calling package (BerkeleyDB). This can lead | to problems in calling code that expects `find_package` result variables | (e.g., `_FOUND`) to follow a certain pattern. | Call Stack (most recent call first): | CMake/FindBerkeleyDB.cmake:57 (find_package_handle_standard_args) | CMakeLists.txt:83 (find_package) | This warning is for project developers. Use -Wno-dev to suppress it. And indeed, we checked for BERKLEY_DB_FOUND which was not defined so our HAVE_BDB was not set – just that it is never used, so it wasn't noticed.
Diffstat (limited to 'CMake/FindGCRYPT.cmake')
-rw-r--r--CMake/FindGCRYPT.cmake25
1 files changed, 25 insertions, 0 deletions
diff --git a/CMake/FindGCRYPT.cmake b/CMake/FindGCRYPT.cmake
new file mode 100644
index 000000000..56bfc9fef
--- /dev/null
+++ b/CMake/FindGCRYPT.cmake
@@ -0,0 +1,25 @@
+# - Try to find GCRYPT
+# Once done, this will define
+#
+# GCRYPT_FOUND - system has GCRYPT
+# GCRYPT_INCLUDE_DIRS - the GCRYPT include directories
+# GCRYPT_LIBRARIES - the GCRYPT library
+find_package(PkgConfig)
+
+pkg_check_modules(GCRYPT_PKGCONF libgcrypt)
+
+find_path(GCRYPT_INCLUDE_DIRS
+ NAMES gcrypt.h
+ PATHS ${GCRYPT_PKGCONF_INCLUDE_DIRS}
+)
+
+
+find_library(GCRYPT_LIBRARIES
+ NAMES gcrypt
+ PATHS ${GCRYPT_PKGCONF_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GCRYPT DEFAULT_MSG GCRYPT_INCLUDE_DIRS GCRYPT_LIBRARIES)
+
+mark_as_advanced(GCRYPT_INCLUDE_DIRS GCRYPT_LIBRARIES)