summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-09-19 13:31:52 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-09-19 13:32:02 (GMT)
commit98d53ba1d6a8815ddd2e446b7c2ba65dd1be7b82 (patch)
tree66fb5b2f6a0123eed4a066c6b4598b839c6d385e /Modules
parent0772d15c2ce5bfd95a87894ee5226d6d74fcff41 (diff)
parent44e8b8f1f222c0227ed72d09310e30524bda9935 (diff)
downloadCMake-98d53ba1d6a8815ddd2e446b7c2ba65dd1be7b82.zip
CMake-98d53ba1d6a8815ddd2e446b7c2ba65dd1be7b82.tar.gz
CMake-98d53ba1d6a8815ddd2e446b7c2ba65dd1be7b82.tar.bz2
Merge topic 'FindGnuTLS-target'
44e8b8f1f2 FindGnuTLS: add target GnuTLS::GnuTLS Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3825
Diffstat (limited to 'Modules')
-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()