2009-08-13 06:25:31 +04:00
|
|
|
# - Try to find the GNU Transport Layer Security library (gnutls)
|
|
|
|
#
|
|
|
|
# Once done this will define
|
|
|
|
#
|
|
|
|
# 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-09-28 19:45:50 +04: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 06:25:31 +04:00
|
|
|
#
|
2009-09-28 19:45:50 +04:00
|
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
# see accompanying file Copyright.txt for details.
|
2009-08-13 06:25:31 +04:00
|
|
|
#
|
2009-09-28 19:45:50 +04: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 04:48:47 +04:00
|
|
|
# (To distribute this file outside of CMake, substitute the full
|
2009-09-28 19:45:50 +04:00
|
|
|
# License text for the above reference.)
|
|
|
|
|
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
|
|
|
|