aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-10-14 20:23:46 +0200
committerPeter Wu <peter@lekensteyn.nl>2015-10-25 14:05:07 +0000
commitfe1ab42f160ac9b67f181775321fa89b62102159 (patch)
tree2fd6e026c1af45a177a01adfcd5dbd3d3d17a9b3 /cmake
parent2ddd92b6f8f587325b9e14598658626f3a007c5c (diff)
Require GnuTLS 2.12.0, add cmake version detection
Since v2.1.0rc0-17-g877fd03 and v2.0.0rc0-23-g263ff53 ("ssl-utils: load RSA keys based on their modulus+exponent"), GnuTLS 2.12.0 is needed. Add a version check to cmake as well, tested on CentOS6 (with pkg-config check disabled to verify the code path). Note that RHEL6 has GnuTLS 2.8.5 and thus SSL decryption with a RSA private key is no longer supported on that version. Change-Id: I99fdfe6790107f48629dd435794fe8880263063d Reviewed-on: https://code.wireshark.org/review/11044 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/FindGNUTLS.cmake19
1 files changed, 16 insertions, 3 deletions
diff --git a/cmake/modules/FindGNUTLS.cmake b/cmake/modules/FindGNUTLS.cmake
index 2803aa8350..c10efee59b 100644
--- a/cmake/modules/FindGNUTLS.cmake
+++ b/cmake/modules/FindGNUTLS.cmake
@@ -20,9 +20,9 @@ FindWSWinLibs("gnutls-.*" "GNUTLS_HINTS")
find_package(PkgConfig)
pkg_search_module(GNUTLS gnutls)
+# sources include gnutls/gnutls.h, look for that location instead of gnutls.h.
FIND_PATH(GNUTLS_INCLUDE_DIR
NAMES
- gnutls.h
gnutls/gnutls.h
PATH_SUFFIXES
include
@@ -42,10 +42,23 @@ FIND_LIBRARY(GNUTLS_LIBRARY
"${GNUTLS_HINTS}/bin"
)
+# On systems without pkg-config (e.g. Windows), search its header
+# (available since GnuTLS 0.1.3)
+if(NOT GNUTLS_VERSION)
+ if(GNUTLS_INCLUDE_DIR)
+ set(_version_regex "^#define[ \t]+GNUTLS_VERSION[ \t]+\"([^\"]+)\".*")
+ file(STRINGS "${GNUTLS_INCLUDE_DIR}/gnutls/gnutls.h" GNUTLS_VERSION REGEX "${_version_regex}")
+ string(REGEX REPLACE "${_version_regex}" "\\1" GNUTLS_VERSION "${GNUTLS_VERSION}")
+ unset(_version_regex)
+ endif()
+endif()
+
# handle the QUIETLY and REQUIRED arguments and set GNUTLS_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(GNUTLS DEFAULT_MSG GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNUTLS
+ REQUIRED_VARS GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR
+ VERSION_VAR GNUTLS_VERSION)
IF(GNUTLS_FOUND)
SET( GNUTLS_LIBRARIES ${GNUTLS_LIBRARY} )