1 # - Try to find the GNU Transport Layer Security library (gnutls)
3 # Once done this will define
5 # GNUTLS_FOUND - System has gnutls
6 # GNUTLS_INCLUDE_DIR - The gnutls include directory
7 # GNUTLS_LIBRARIES - The libraries needed to use gnutls
8 # GNUTLS_DEFINITIONS - Compiler switches required for using gnutls
10 #=============================================================================
11 # Copyright 2009 Kitware, Inc.
12 # Copyright 2009 Philip Lowman <philip@yhbt.com>
13 # Copyright 2009 Brad Hards <bradh@kde.org>
14 # Copyright 2006 Alexander Neundorf <neundorf@kde.org>
16 # Distributed under the OSI-approved BSD License (the "License");
17 # see accompanying file Copyright.txt for details.
19 # This software is distributed WITHOUT ANY WARRANTY; without even the
20 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 # See the License for more information.
22 #=============================================================================
23 # (To distribute this file outside of CMake, substitute the full
24 # License text for the above reference.)
26 # Note that this doesn't try to find the gnutls-extra package.
29 if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY)
31 set(gnutls_FIND_QUIETLY TRUE)
35 # try using pkg-config to get the directories and then use these values
36 # in the find_path() and find_library() calls
37 # also fills in GNUTLS_DEFINITIONS, although that isn't normally useful
38 find_package(PkgConfig QUIET)
39 PKG_CHECK_MODULES(PC_GNUTLS QUIET gnutls)
40 set(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER})
41 set(GNUTLS_VERSION_STRING ${PC_GNUTLS_VERSION})
44 find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h
46 ${PC_GNUTLS_INCLUDEDIR}
47 ${PC_GNUTLS_INCLUDE_DIRS}
50 find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls
53 ${PC_GNUTLS_LIBRARY_DIRS}
56 mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY)
58 # handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if
59 # all listed variables are TRUE
60 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
61 FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS
62 REQUIRED_VARS GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR
63 VERSION_VAR GNUTLS_VERSION_STRING)
66 set(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY})
67 set(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR})