2016-09-27 19:01:08 +00: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 15:17:36 +00:00
|
|
|
#.rst:
|
|
|
|
# FindGnuTLS
|
|
|
|
# ----------
|
|
|
|
#
|
|
|
|
# Try to find the GNU Transport Layer Security library (gnutls)
|
|
|
|
#
|
|
|
|
#
|
2009-08-13 02:25:31 +00:00
|
|
|
#
|
|
|
|
# Once done this will define
|
|
|
|
#
|
2013-10-15 15:17:36 +00: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 02:25:31 +00:00
|
|
|
|
|
|
|
# Note that this doesn't try to find the gnutls-extra package.
|
|
|
|
|
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARY)
|
2009-08-13 02:25:31 +00:00
|
|
|
# in cache already
|
2012-08-13 17:47:32 +00:00
|
|
|
set(gnutls_FIND_QUIETLY TRUE)
|
2012-08-13 17:50:14 +00:00
|
|
|
endif ()
|
2009-08-13 02:25:31 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
if (NOT WIN32)
|
2009-08-13 02:25:31 +00:00
|
|
|
# try using pkg-config to get the directories and then use these values
|
2012-08-13 17:47:32 +00:00
|
|
|
# in the find_path() and find_library() calls
|
2009-08-13 02:25:31 +00:00
|
|
|
# also fills in GNUTLS_DEFINITIONS, although that isn't normally useful
|
2012-08-13 17:47:32 +00:00
|
|
|
find_package(PkgConfig QUIET)
|
2012-01-23 18:03:54 +00:00
|
|
|
PKG_CHECK_MODULES(PC_GNUTLS QUIET gnutls)
|
2012-08-13 17:47:32 +00:00
|
|
|
set(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER})
|
|
|
|
set(GNUTLS_VERSION_STRING ${PC_GNUTLS_VERSION})
|
2012-08-13 17:50:14 +00:00
|
|
|
endif ()
|
2009-08-13 02:25:31 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
find_path(GNUTLS_INCLUDE_DIR gnutls/gnutls.h
|
2009-08-13 02:25:31 +00:00
|
|
|
HINTS
|
|
|
|
${PC_GNUTLS_INCLUDEDIR}
|
|
|
|
${PC_GNUTLS_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls
|
2009-08-13 02:25:31 +00:00
|
|
|
HINTS
|
|
|
|
${PC_GNUTLS_LIBDIR}
|
|
|
|
${PC_GNUTLS_LIBRARY_DIRS}
|
|
|
|
)
|
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY)
|
2009-10-09 02:50:13 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
2012-01-23 18:19:10 +00:00
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS
|
|
|
|
REQUIRED_VARS GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR
|
|
|
|
VERSION_VAR GNUTLS_VERSION_STRING)
|
2009-08-13 02:25:31 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
if(GNUTLS_FOUND)
|
|
|
|
set(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY})
|
|
|
|
set(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR})
|
|
|
|
endif()
|