Mercurial > hg > freeDiameter
annotate cmake/Modules/FindGnuTLS.cmake @ 801:728cc60a7be5
Test version only on found library
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Tue, 21 Aug 2012 22:24:14 +0200 |
parents | 36821971d47b |
children | 6dde862ba119 |
rev | line source |
---|---|
15
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1 # - Find gnutls |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
2 # Find the native GNUTLS includes and library |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
3 # |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
4 # GNUTLS_FOUND - True if gnutls found. |
493
d68f27e7e814
Fixed a few CMake variable names
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
304
diff
changeset
|
5 # GNUTLS_INCLUDE_DIR - where to find gnutls.h, etc. |
15
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
6 # GNUTLS_LIBRARIES - List of libraries when using gnutls. |
797
36821971d47b
Renamed GNUTLS_NEW_VERSION and added GNUTLS_VERSION_300 to prepare for API change in gnutls
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
747
diff
changeset
|
7 # GNUTLS_VERSION_210 - true if GnuTLS version is >= 2.10.0 (does not require additional separate gcrypt initialization) |
36821971d47b
Renamed GNUTLS_NEW_VERSION and added GNUTLS_VERSION_300 to prepare for API change in gnutls
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
747
diff
changeset
|
8 # GNUTLS_VERSION_300 - true if GnuTLS version is >= 3.00.0 (x509 verification functions changed) |
15
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
9 |
493
d68f27e7e814
Fixed a few CMake variable names
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
304
diff
changeset
|
10 if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARIES) |
15
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
11 set(GNUTLS_FIND_QUIETLY TRUE) |
493
d68f27e7e814
Fixed a few CMake variable names
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
304
diff
changeset
|
12 endif (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARIES) |
15
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
13 |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
14 # Include dir |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
15 find_path(GNUTLS_INCLUDE_DIR |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
16 NAMES |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
17 gnutls.h |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
18 gnutls/gnutls.h |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
19 ) |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
20 |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
21 # Library |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
22 find_library(GNUTLS_LIBRARY |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
23 NAMES gnutls |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
24 ) |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
25 |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
26 # handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
27 # all listed variables are TRUE |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
28 INCLUDE(FindPackageHandleStandardArgs) |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
29 FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNUTLS DEFAULT_MSG GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR) |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
30 |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
31 IF(GNUTLS_FOUND) |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
32 SET( GNUTLS_LIBRARIES ${GNUTLS_LIBRARY} ) |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
33 ELSE(GNUTLS_FOUND) |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
34 SET( GNUTLS_LIBRARIES ) |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
35 ENDIF(GNUTLS_FOUND) |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
36 |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
37 # Lastly make it so that the GNUTLS_LIBRARY and GNUTLS_INCLUDE_DIR variables |
050f4f6f9f2a
Added new FindGNUTLS cmake module
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
38 # only show up under the advanced options in the gui cmake applications. |
304
ad3c46016584
Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
284
diff
changeset
|
39 MARK_AS_ADVANCED( GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR ) |
746
96c75744d3c4
Attempt to support newer GNU TLS libraries. Need more work...
Sebastien Decugis <sdecugis@freediameter.net>
parents:
493
diff
changeset
|
40 |
96c75744d3c4
Attempt to support newer GNU TLS libraries. Need more work...
Sebastien Decugis <sdecugis@freediameter.net>
parents:
493
diff
changeset
|
41 # Now check if the library is recent. gnutls_hash was added in 2.10.0. |
797
36821971d47b
Renamed GNUTLS_NEW_VERSION and added GNUTLS_VERSION_300 to prepare for API change in gnutls
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
747
diff
changeset
|
42 # Also test library is even more recent. gnutls_x509_trust_list_verify_crt was added in 3.00.0. |
801
728cc60a7be5
Test version only on found library
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
797
diff
changeset
|
43 IF(GNUTLS_FOUND) |
728cc60a7be5
Test version only on found library
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
797
diff
changeset
|
44 IF( NOT( "${GNUTLS_VERSION_TEST_FOR}" STREQUAL "${GNUTLS_LIBRARY}" )) |
728cc60a7be5
Test version only on found library
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
797
diff
changeset
|
45 INCLUDE (CheckLibraryExists) |
728cc60a7be5
Test version only on found library
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
797
diff
changeset
|
46 MESSAGE(STATUS "Rechecking GNUTLS_VERSION_210 and GNUTLS_VERSION_300") |
728cc60a7be5
Test version only on found library
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
797
diff
changeset
|
47 UNSET(GNUTLS_VERSION_210) |
728cc60a7be5
Test version only on found library
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
797
diff
changeset
|
48 UNSET(GNUTLS_VERSION_210 CACHE) |
728cc60a7be5
Test version only on found library
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
797
diff
changeset
|
49 UNSET(GNUTLS_VERSION_300) |
728cc60a7be5
Test version only on found library
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
797
diff
changeset
|
50 UNSET(GNUTLS_VERSION_300 CACHE) |
728cc60a7be5
Test version only on found library
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
797
diff
changeset
|
51 GET_FILENAME_COMPONENT(GNUTLS_PATH ${GNUTLS_LIBRARY} PATH) |
728cc60a7be5
Test version only on found library
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
797
diff
changeset
|
52 CHECK_LIBRARY_EXISTS(gnutls gnutls_hash ${GNUTLS_PATH} GNUTLS_VERSION_210) |
728cc60a7be5
Test version only on found library
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
797
diff
changeset
|
53 CHECK_LIBRARY_EXISTS(gnutls gnutls_x509_trust_list_verify_crt ${GNUTLS_PATH} GNUTLS_VERSION_300) |
728cc60a7be5
Test version only on found library
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
797
diff
changeset
|
54 SET( GNUTLS_VERSION_TEST_FOR ${GNUTLS_LIBRARY} CACHE INTERNAL "Version the test was made against" ) |
728cc60a7be5
Test version only on found library
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
797
diff
changeset
|
55 ENDIF (NOT( "${GNUTLS_VERSION_TEST_FOR}" STREQUAL "${GNUTLS_LIBRARY}" )) |
728cc60a7be5
Test version only on found library
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
797
diff
changeset
|
56 ENDIF(GNUTLS_FOUND) |