summaryrefslogtreecommitdiffstats
path: root/Modules/FindGnuTLS.cmake
diff options
context:
space:
mode:
authorDavid Callu <callu.david@gmail.com>2019-09-17 08:22:41 (GMT)
committerBrad King <brad.king@kitware.com>2019-09-18 16:03:53 (GMT)
commit44e8b8f1f222c0227ed72d09310e30524bda9935 (patch)
tree7fdc361f34d0dd2da485eb94b3f7a0b8d16ab281 /Modules/FindGnuTLS.cmake
parent729c928c7b59919a9d379891973bda22665c75da (diff)
downloadCMake-44e8b8f1f222c0227ed72d09310e30524bda9935.zip
CMake-44e8b8f1f222c0227ed72d09310e30524bda9935.tar.gz
CMake-44e8b8f1f222c0227ed72d09310e30524bda9935.tar.bz2
FindGnuTLS: add target GnuTLS::GnuTLS
Also add a test case for the module.
Diffstat (limited to 'Modules/FindGnuTLS.cmake')
-rw-r--r--Modules/FindGnuTLS.cmake40
1 files changed, 30 insertions, 10 deletions
diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake
index 123a0f5..819f000 100644
--- a/Modules/FindGnuTLS.cmake
+++ b/Modules/FindGnuTLS.cmake
@@ -7,16 +7,25 @@ FindGnuTLS
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
+IMPORTED Targets
+^^^^^^^^^^^^^^^^
+
+This module defines :prop_tgt:`IMPORTED` target ``GnuTLS::GnuTLS``, if
+gnutls has been found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+``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
+``GNUTLS_VERSION``
+ version of gnutls.
#]=======================================================================]
# Note that this doesn't try to find the gnutls-extra package.
@@ -34,6 +43,8 @@ if (NOT WIN32)
find_package(PkgConfig QUIET)
PKG_CHECK_MODULES(PC_GNUTLS QUIET gnutls)
set(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER})
+ set(GNUTLS_VERSION ${PC_GNUTLS_VERSION})
+ # keep for backward compatibility
set(GNUTLS_VERSION_STRING ${PC_GNUTLS_VERSION})
endif ()
@@ -59,4 +70,13 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS
if(GNUTLS_FOUND)
set(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY})
set(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR})
+
+ if(NOT TARGET GnuTLS::GnuTLS)
+ add_library(GnuTLS::GnuTLS UNKNOWN IMPORTED)
+ set_target_properties(GnuTLS::GnuTLS PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIRS}"
+ INTERFACE_COMPILE_DEFINITIONS "${GNUTLS_DEFINITIONS}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${GNUTLS_LIBRARIES}")
+ endif()
endif()