comparison cmake/Modules/FindGnuTLS.cmake @ 1223:33ad82ffbdde

Make GNU TLS 3.x mandatory since we want to support DTLS. Removed the old compatibility code.
author Sebastien Decugis <sdecugis@freediameter.net>
date Wed, 19 Jun 2013 14:38:57 +0800
parents 56c36d1007b4
children def1b0ac48dc
comparison
equal deleted inserted replaced
1222:5d0d300a7cd9 1223:33ad82ffbdde
1 # - Find gnutls 1 # - Find gnutls
2 # Find the native GNUTLS includes and library 2 # Find the native GNUTLS includes and library. Version 3.0.0 at least is required
3 # 3 #
4 # GNUTLS_FOUND - True if gnutls found. 4 # GNUTLS_FOUND - True if gnutls found.
5 # GNUTLS_INCLUDE_DIR - where to find gnutls.h, etc. 5 # GNUTLS_INCLUDE_DIR - where to find gnutls.h, etc.
6 # GNUTLS_LIBRARIES - List of libraries when using gnutls. 6 # GNUTLS_LIBRARIES - List of libraries when using gnutls.
7 # GNUTLS_VERSION_210 - true if GnuTLS version is >= 2.10.0 (does not require additional separate gcrypt initialization)
8 # GNUTLS_VERSION_212 - true if GnuTLS version is >= 2.12.0 (supports gnutls_transport_set_vec_push_function)
9 # GNUTLS_VERSION_300 - true if GnuTLS version is >= 3.00.0 (x509 verification functions changed)
10 # GNUTLS_VERSION_310 - true if GnuTLS version is >= 3.01.0 (stabilization branch with new APIs) 7 # GNUTLS_VERSION_310 - true if GnuTLS version is >= 3.01.0 (stabilization branch with new APIs)
8 # GNUTLS_VERSION_322 - true if GnuTLS version is >= 3.2.2 (DTLS over SCTP improvements)
11 9
12 if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARIES) 10 if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARIES)
13 set(GNUTLS_FIND_QUIETLY TRUE) 11 set(GNUTLS_FIND_QUIETLY TRUE)
14 endif (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARIES) 12 endif (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARIES)
15 13
44 # Also test library is even more recent. gnutls_x509_trust_list_verify_crt was added in 3.00.0. 42 # Also test library is even more recent. gnutls_x509_trust_list_verify_crt was added in 3.00.0.
45 IF(GNUTLS_FOUND) 43 IF(GNUTLS_FOUND)
46 IF( NOT( "${GNUTLS_VERSION_TEST_FOR}" STREQUAL "${GNUTLS_LIBRARY}" )) 44 IF( NOT( "${GNUTLS_VERSION_TEST_FOR}" STREQUAL "${GNUTLS_LIBRARY}" ))
47 INCLUDE (CheckLibraryExists) 45 INCLUDE (CheckLibraryExists)
48 MESSAGE(STATUS "Checking GNUTLS version") 46 MESSAGE(STATUS "Checking GNUTLS version")
49 UNSET(GNUTLS_VERSION_210)
50 UNSET(GNUTLS_VERSION_210 CACHE)
51 UNSET(GNUTLS_VERSION_212)
52 UNSET(GNUTLS_VERSION_212 CACHE)
53 UNSET(GNUTLS_VERSION_300)
54 UNSET(GNUTLS_VERSION_300 CACHE)
55 UNSET(GNUTLS_VERSION_310) 47 UNSET(GNUTLS_VERSION_310)
56 UNSET(GNUTLS_VERSION_310 CACHE) 48 UNSET(GNUTLS_VERSION_310 CACHE)
49 UNSET(GNUTLS_VERSION_322)
50 UNSET(GNUTLS_VERSION_322 CACHE)
57 GET_FILENAME_COMPONENT(GNUTLS_PATH ${GNUTLS_LIBRARY} PATH) 51 GET_FILENAME_COMPONENT(GNUTLS_PATH ${GNUTLS_LIBRARY} PATH)
58 CHECK_LIBRARY_EXISTS(gnutls gnutls_hash ${GNUTLS_PATH} GNUTLS_VERSION_210)
59 CHECK_LIBRARY_EXISTS(gnutls gnutls_transport_set_vec_push_function ${GNUTLS_PATH} GNUTLS_VERSION_212)
60 CHECK_LIBRARY_EXISTS(gnutls gnutls_x509_trust_list_verify_crt ${GNUTLS_PATH} GNUTLS_VERSION_300) 52 CHECK_LIBRARY_EXISTS(gnutls gnutls_x509_trust_list_verify_crt ${GNUTLS_PATH} GNUTLS_VERSION_300)
53 IF(!GNUTLS_VERSION_300)
54 MESSAGE(FATAL_ERROR "GnuTLS found but version is too old, need 3.x at least for DTLS support")
55 ENDIF(!GNUTLS_VERSION_300)
61 CHECK_LIBRARY_EXISTS(gnutls gnutls_handshake_set_timeout ${GNUTLS_PATH} GNUTLS_VERSION_310) 56 CHECK_LIBRARY_EXISTS(gnutls gnutls_handshake_set_timeout ${GNUTLS_PATH} GNUTLS_VERSION_310)
57 CHECK_LIBRARY_EXISTS(gnutls gnutls_handshake_set_hook_function ${GNUTLS_PATH} GNUTLS_VERSION_322)
62 SET( GNUTLS_VERSION_TEST_FOR ${GNUTLS_LIBRARY} CACHE INTERNAL "Version the test was made against" ) 58 SET( GNUTLS_VERSION_TEST_FOR ${GNUTLS_LIBRARY} CACHE INTERNAL "Version the test was made against" )
63 ENDIF (NOT( "${GNUTLS_VERSION_TEST_FOR}" STREQUAL "${GNUTLS_LIBRARY}" )) 59 ENDIF (NOT( "${GNUTLS_VERSION_TEST_FOR}" STREQUAL "${GNUTLS_LIBRARY}" ))
64 ENDIF(GNUTLS_FOUND) 60 ENDIF(GNUTLS_FOUND)
"Welcome to our mercurial repository"