aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-10-14 19:40:24 +0200
committerAnders Broman <a.broman58@gmail.com>2015-10-20 03:28:55 +0000
commit82ec0bb0fc6bf551693d26c8a575bb3fbd9d0264 (patch)
tree340b8d34a0b24b43294c27c2d6df1cc7691d7c8d /cmake
parenta86acb2ac7493430d5a506f6bbe5969098fc19f6 (diff)
Require libgcrypt 1.4.2, add cmake version detection
libgcrypt 1.4.2 is required since since v1.11.0-rc1-2787-g23f9100 ("Really add support for AEAD ciphers (GCM)") due to the use of gcry_cipher_setctr. Bump the version in configure.ac too. Add version check for gcrypt to cmake. Tested with CentOS 6 (cmake 2.8.12.2, libgcrypt 1.4.5). Change-Id: I93c3ed902a764d9d14675779e866230d073c96d5 Reviewed-on: https://code.wireshark.org/review/11043 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/FindGCRYPT.cmake14
1 files changed, 12 insertions, 2 deletions
diff --git a/cmake/modules/FindGCRYPT.cmake b/cmake/modules/FindGCRYPT.cmake
index 0b4271a8ed..8c0a367033 100644
--- a/cmake/modules/FindGCRYPT.cmake
+++ b/cmake/modules/FindGCRYPT.cmake
@@ -28,10 +28,20 @@ SET(GCRYPT_NAMES gcrypt libgcrypt-20)
FIND_LIBRARY(GCRYPT_LIBRARY NAMES ${GCRYPT_NAMES} libgcc_s_sjlj-1 HINTS "${GCRYPT_HINTS}/bin")
FIND_LIBRARY(GCRYPT_ERROR_LIBRARY NAMES gpg-error libgpg-error-0 libgpg-error6-0 HINTS "${GCRYPT_HINTS}/bin")
+# Try to retrieve version from header if found (available since libgcrypt 1.3.0)
+if(GCRYPT_INCLUDE_DIR)
+ set(_version_regex "^#define[ \t]+GCRYPT_VERSION[ \t]+\"([^\"]+)\".*")
+ file(STRINGS "${GCRYPT_INCLUDE_DIR}/gcrypt.h" GCRYPT_VERSION REGEX "${_version_regex}")
+ string(REGEX REPLACE "${_version_regex}" "\\1" GCRYPT_VERSION "${GCRYPT_VERSION}")
+ unset(_version_regex)
+endif()
+
# handle the QUIETLY and REQUIRED arguments and set GCRYPT_FOUND to TRUE if
-# all listed variables are TRUE
+# all listed variables are TRUE and the requested version matches.
INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GCRYPT DEFAULT_MSG GCRYPT_LIBRARY GCRYPT_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GCRYPT
+ REQUIRED_VARS GCRYPT_LIBRARY GCRYPT_INCLUDE_DIR
+ VERSION_VAR GCRYPT_VERSION)
IF(GCRYPT_FOUND)
SET( GCRYPT_LIBRARIES ${GCRYPT_LIBRARY} ${GCRYPT_ERROR_LIBRARY})