2016-09-27 22:01:08 +03:00
|
|
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
|
|
|
2013-10-15 19:17:36 +04:00
|
|
|
#.rst:
|
|
|
|
# FindGnuTLS
|
|
|
|
# ----------
|
|
|
|
#
|
|
|
|
# Try to find the GNU Transport Layer Security library (gnutls)
|
|
|
|
#
|
|
|
|
#
|
2009-08-13 06:25:31 +04:00
|
|
|
#
|
|
|
|
# Once done this will define
|
|
|
|
#
|
2013-10-15 19:17:36 +04:00
|
|
|
# ::
|
|
|
|
#
|
|
|
|
# GNUTLS_FOUND - System has gnutls
|
|
|
|
# GNUTLS_INCLUDE_DIR - The gnutls include directory
|
|
|
|
# GNUTLS_LIBRARIES - The libraries needed to use gnutls
|
|
|
|
# GNUTLS_DEFINITIONS - Compiler switches required for using gnutls
|
2009-08-13 06:25:31 +04:00
|
|
|
|
|
|
|
# Note that this doesn't try to find the gnutls-extra package.
|
|
|
|
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY)
|
2009-08-13 06:25:31 +04:00
|
|
|
# in cache already
|
2012-08-13 21:47:32 +04:00
|
|
|
set(gnutls_FIND_QUIETLY TRUE)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
2009-08-13 06:25:31 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if (NOT WIN32)
|
2009-08-13 06:25:31 +04:00
|
|
|
# try using pkg-config to get the directories and then use these values
|
2012-08-13 21:47:32 +04:00
|
|
|
# in the find_path() and find_library() calls
|
2009-08-13 06:25:31 +04:00
|
|
|
# also fills in GNUTLS_DEFINITIONS, although that isn't normally useful
|
2012-08-13 21:47:32 +04:00
|
|
|
find_package(PkgConfig QUIET)
|
2012-01-23 22:03:54 +04:00
|
|
|
PKG_CHECK_MODULES(PC_GNUTLS QUIET gnutls)
|
2012-08-13 21:47:32 +04:00
|
|
|
set(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER})
|
|
|
|
set(GNUTLS_VERSION_STRING ${PC_GNUTLS_VERSION})
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
2009-08-13 06:25:31 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h
|
2009-08-13 06:25:31 +04:00
|
|
|
HINTS
|
|
|
|
${PC_GNUTLS_INCLUDEDIR}
|
|
|
|
${PC_GNUTLS_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls
|
2009-08-13 06:25:31 +04:00
|
|
|
HINTS
|
|
|
|
${PC_GNUTLS_LIBDIR}
|
|
|
|
${PC_GNUTLS_LIBRARY_DIRS}
|
|
|
|
)
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY)
|
2009-10-09 06:50:13 +04:00
|
|
|
|
2012-08-13 21:42:58 +04:00
|
|
|
# handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if
|
2009-08-13 06:25:31 +04:00
|
|
|
# all listed variables are TRUE
|
2012-08-13 21:47:32 +04:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
2012-01-23 22:19:10 +04:00
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS
|
|
|
|
REQUIRED_VARS GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR
|
|
|
|
VERSION_VAR GNUTLS_VERSION_STRING)
|
2009-08-13 06:25:31 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(GNUTLS_FOUND)
|
|
|
|
set(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY})
|
|
|
|
set(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR})
|
|
|
|
endif()
|
2009-08-13 06:25:31 +04:00
|
|
|
|