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
|
|
|
|
2009-09-28 15:45:50 +00:00
|
|
|
#=============================================================================
|
|
|
|
# Copyright 2009 Kitware, Inc.
|
|
|
|
# Copyright 2009 Philip Lowman <philip@yhbt.com>
|
|
|
|
# Copyright 2009 Brad Hards <bradh@kde.org>
|
|
|
|
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
|
2009-08-13 02:25:31 +00:00
|
|
|
#
|
2009-09-28 15:45:50 +00:00
|
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
# see accompanying file Copyright.txt for details.
|
2009-08-13 02:25:31 +00:00
|
|
|
#
|
2009-09-28 15:45:50 +00:00
|
|
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# See the License for more information.
|
|
|
|
#=============================================================================
|
2010-08-07 00:48:47 +00:00
|
|
|
# (To distribute this file outside of CMake, substitute the full
|
2009-09-28 15:45:50 +00:00
|
|
|
# License text for the above reference.)
|
|
|
|
|
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:42:58 +00:00
|
|
|
# handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if
|
2009-08-13 02:25:31 +00:00
|
|
|
# all listed variables are TRUE
|
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()
|
2009-08-13 02:25:31 +00:00
|
|
|
|