[Cmake-commits] CMake branch, master, updated. v3.15.3-1080-gcca5897

Kitware Robot kwrobot at kitware.com
Thu Sep 19 09:38:37 EDT 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  cca5897318d5c747078f79cd5bb45ba74955102a (commit)
       via  98d53ba1d6a8815ddd2e446b7c2ba65dd1be7b82 (commit)
       via  13a7c858c8acfa530badcb7ad53b5494e0c37aae (commit)
       via  44e8b8f1f222c0227ed72d09310e30524bda9935 (commit)
      from  0772d15c2ce5bfd95a87894ee5226d6d74fcff41 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cca5897318d5c747078f79cd5bb45ba74955102a
commit cca5897318d5c747078f79cd5bb45ba74955102a
Merge: 98d53ba 13a7c85
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Sep 19 13:33:17 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Sep 19 09:34:23 2019 -0400

    Merge topic 'CMakeFindBinUtils-install_name_tool-prefix'
    
    13a7c858c8 Use _CMAKE_TOOLCHAIN_PREFIX for install_name_tool as well
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3830


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=98d53ba1d6a8815ddd2e446b7c2ba65dd1be7b82
commit 98d53ba1d6a8815ddd2e446b7c2ba65dd1be7b82
Merge: 0772d15 44e8b8f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Sep 19 13:31:52 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Sep 19 09:32:02 2019 -0400

    Merge topic 'FindGnuTLS-target'
    
    44e8b8f1f2 FindGnuTLS: add target GnuTLS::GnuTLS
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3825


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=13a7c858c8acfa530badcb7ad53b5494e0c37aae
commit 13a7c858c8acfa530badcb7ad53b5494e0c37aae
Author:     Isuru Fernando <isuruf at gmail.com>
AuthorDate: Wed Sep 18 12:05:39 2019 -0400
Commit:     Isuru Fernando <isuruf at gmail.com>
CommitDate: Wed Sep 18 12:05:39 2019 -0400

    Use _CMAKE_TOOLCHAIN_PREFIX for install_name_tool as well

diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index 01f9dae..781b48c 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -134,7 +134,7 @@ else()
 endif()
 
 if(CMAKE_PLATFORM_HAS_INSTALLNAME)
-  find_program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+  find_program(CMAKE_INSTALL_NAME_TOOL NAMES ${_CMAKE_TOOLCHAIN_PREFIX}install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
 
   if(NOT CMAKE_INSTALL_NAME_TOOL)
     message(FATAL_ERROR "Could not find install_name_tool, please check your installation.")

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=44e8b8f1f222c0227ed72d09310e30524bda9935
commit 44e8b8f1f222c0227ed72d09310e30524bda9935
Author:     David Callu <callu.david at gmail.com>
AuthorDate: Tue Sep 17 10:22:41 2019 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 18 12:03:53 2019 -0400

    FindGnuTLS: add target GnuTLS::GnuTLS
    
    Also add a test case for the module.

diff --git a/Help/release/dev/FindGnuTLS-target.rst b/Help/release/dev/FindGnuTLS-target.rst
new file mode 100644
index 0000000..671a7b7
--- /dev/null
+++ b/Help/release/dev/FindGnuTLS-target.rst
@@ -0,0 +1,4 @@
+FindGnuTLS-target
+-----------------
+
+* The :module:`FindGnuTLS` module now provides an imported target.
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()
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index c14107a..78ae7aa 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1394,6 +1394,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
             GIF
             Git
             GLEW
+            GnuTLS
             GSL
             GTK2
             Iconv
diff --git a/Tests/FindGnuTLS/CMakeLists.txt b/Tests/FindGnuTLS/CMakeLists.txt
new file mode 100644
index 0000000..059ac7b
--- /dev/null
+++ b/Tests/FindGnuTLS/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindGnuTLS.Test COMMAND
+  ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+  --build-and-test
+  "${CMake_SOURCE_DIR}/Tests/FindGnuTLS/Test"
+  "${CMake_BINARY_DIR}/Tests/FindGnuTLS/Test"
+  ${build_generator_args}
+  --build-project TestFindGnuTLS
+  --build-options ${build_options}
+  --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+  )
diff --git a/Tests/FindGnuTLS/Test/CMakeLists.txt b/Tests/FindGnuTLS/Test/CMakeLists.txt
new file mode 100644
index 0000000..c5a9819
--- /dev/null
+++ b/Tests/FindGnuTLS/Test/CMakeLists.txt
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.4)
+project(TestFindGnuTLS C)
+include(CTest)
+
+find_package(GnuTLS REQUIRED)
+
+add_definitions(-DCMAKE_EXPECTED_GNUTLS_VERSION="${GNUTLS_VERSION}")
+
+add_executable(test_tgt main.c)
+target_link_libraries(test_tgt GnuTLS::GnuTLS)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.c)
+target_include_directories(test_var PRIVATE ${GNUTLS_INCLUDE_DIRS})
+target_link_libraries(test_var PRIVATE ${GNUTLS_LIBRARIES})
+target_compile_definitions(test_var PRIVATE ${GNUTLS_DEFINITIONS})
+add_test(NAME test_var COMMAND test_var)
diff --git a/Tests/FindGnuTLS/Test/main.c b/Tests/FindGnuTLS/Test/main.c
new file mode 100644
index 0000000..122fb2d
--- /dev/null
+++ b/Tests/FindGnuTLS/Test/main.c
@@ -0,0 +1,22 @@
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <gnutls/gnutls.h>
+
+int main()
+{
+  // test the linker
+  gnutls_session_t session;
+  if (gnutls_init(&session, GNUTLS_CLIENT)) {
+    gnutls_deinit(session);
+  }
+
+  // check the version
+  char gnutls_version_string[16];
+  snprintf(gnutls_version_string, 16, "%i.%i.%i", GNUTLS_VERSION_MAJOR,
+           GNUTLS_VERSION_MINOR, GNUTLS_VERSION_PATCH);
+  assert(strcmp(gnutls_version_string, CMAKE_EXPECTED_GNUTLS_VERSION) == 0);
+
+  return 0;
+}

-----------------------------------------------------------------------

Summary of changes:
 Help/release/dev/FindGnuTLS-target.rst        |  4 +++
 Modules/CMakeFindBinUtils.cmake               |  2 +-
 Modules/FindGnuTLS.cmake                      | 40 ++++++++++++++++++++-------
 Tests/CMakeLists.txt                          |  1 +
 Tests/{FindCURL => FindGnuTLS}/CMakeLists.txt |  8 +++---
 Tests/FindGnuTLS/Test/CMakeLists.txt          | 17 ++++++++++++
 Tests/FindGnuTLS/Test/main.c                  | 22 +++++++++++++++
 7 files changed, 79 insertions(+), 15 deletions(-)
 create mode 100644 Help/release/dev/FindGnuTLS-target.rst
 copy Tests/{FindCURL => FindGnuTLS}/CMakeLists.txt (54%)
 create mode 100644 Tests/FindGnuTLS/Test/CMakeLists.txt
 create mode 100644 Tests/FindGnuTLS/Test/main.c


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list