[Cmake-commits] CMake branch, master, updated. v3.11.1-515-g6774e9c

Kitware Robot kwrobot at kitware.com
Tue Apr 17 17:25:04 EDT 2018


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  6774e9cabfb1a9676b787be26cd120e88d6fc21a (commit)
       via  912a6c1cb5949fafe8b17216f162a16261d59d0c (commit)
      from  80d49468de07d194576ead24ff6f2999e1fe32e6 (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=6774e9cabfb1a9676b787be26cd120e88d6fc21a
commit 6774e9cabfb1a9676b787be26cd120e88d6fc21a
Merge: 80d4946 912a6c1
Author:     Craig Scott <craig.scott at crascit.com>
AuthorDate: Tue Apr 17 21:23:39 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Apr 17 17:23:47 2018 -0400

    Merge topic 'FindOpenSSL-components'
    
    912a6c1cb5 FindOpenSSL: Add component support
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1929


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=912a6c1cb5949fafe8b17216f162a16261d59d0c
commit 912a6c1cb5949fafe8b17216f162a16261d59d0c
Author:     Harry Mallon <hjmallon at gmail.com>
AuthorDate: Mon Apr 16 12:38:35 2018 +0100
Commit:     Harry Mallon <hjmallon at gmail.com>
CommitDate: Mon Apr 16 12:38:39 2018 +0100

    FindOpenSSL: Add component support

diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index c358ff1..d5cd8bc 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -7,6 +7,12 @@
 #
 # Find the OpenSSL encryption library.
 #
+# Optional COMPONENTS
+# ^^^^^^^^^^^^^^^^^^^
+#
+# This module supports two optional COMPONENTS: ``Crypto`` and ``SSL``.  Both
+# components have associated imported targets, as described below.
+#
 # Imported Targets
 # ^^^^^^^^^^^^^^^^
 #
@@ -23,7 +29,8 @@
 # This module will set the following variables in your project:
 #
 # ``OPENSSL_FOUND``
-#   System has the OpenSSL library.
+#   System has the OpenSSL library. If no components are requested it only
+#   requires the crypto library.
 # ``OPENSSL_INCLUDE_DIR``
 #   The OpenSSL include directory.
 # ``OPENSSL_CRYPTO_LIBRARY``
@@ -371,28 +378,47 @@ if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
   endif ()
 endif ()
 
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-
 set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} )
 
-if (OPENSSL_VERSION)
-  find_package_handle_standard_args(OpenSSL
-    REQUIRED_VARS
-      #OPENSSL_SSL_LIBRARY # FIXME: require based on a component request?
-      OPENSSL_CRYPTO_LIBRARY
-      OPENSSL_INCLUDE_DIR
-    VERSION_VAR
-      OPENSSL_VERSION
-    FAIL_MESSAGE
-      "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
-  )
-else ()
-  find_package_handle_standard_args(OpenSSL "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
-    #OPENSSL_SSL_LIBRARY # FIXME: require based on a component request?
+foreach(_comp IN LISTS OpenSSL_FIND_COMPONENTS)
+  if(_comp STREQUAL "Crypto")
+    if(EXISTS "${OPENSSL_INCLUDE_DIR}" AND
+        (EXISTS "${OPENSSL_CRYPTO_LIBRARY}" OR
+        EXISTS "${LIB_EAY_LIBRARY_DEBUG}" OR
+        EXISTS "${LIB_EAY_LIBRARY_RELEASE}")
+    )
+      set(OpenSSL_${_comp}_FOUND TRUE)
+    else()
+      set(OpenSSL_${_comp}_FOUND FALSE)
+    endif()
+  elseif(_comp STREQUAL "SSL")
+    if(EXISTS "${OPENSSL_INCLUDE_DIR}" AND
+        (EXISTS "${OPENSSL_SSL_LIBRARY}" OR
+        EXISTS "${SSL_EAY_LIBRARY_DEBUG}" OR
+        EXISTS "${SSL_EAY_LIBRARY_RELEASE}")
+    )
+      set(OpenSSL_${_comp}_FOUND TRUE)
+    else()
+      set(OpenSSL_${_comp}_FOUND FALSE)
+    endif()
+  else()
+    message(WARNING "${_comp} is not a valid OpenSSL component")
+    set(OpenSSL_${_comp}_FOUND FALSE)
+  endif()
+endforeach()
+unset(_comp)
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(OpenSSL
+  REQUIRED_VARS
     OPENSSL_CRYPTO_LIBRARY
     OPENSSL_INCLUDE_DIR
-  )
-endif ()
+  VERSION_VAR
+    OPENSSL_VERSION
+  HANDLE_COMPONENTS
+  FAIL_MESSAGE
+    "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
+)
 
 mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)
 
@@ -425,6 +451,7 @@ if(OPENSSL_FOUND)
         IMPORTED_LOCATION_DEBUG "${LIB_EAY_LIBRARY_DEBUG}")
     endif()
   endif()
+
   if(NOT TARGET OpenSSL::SSL AND
       (EXISTS "${OPENSSL_SSL_LIBRARY}" OR
         EXISTS "${SSL_EAY_LIBRARY_DEBUG}" OR

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

Summary of changes:
 Modules/FindOpenSSL.cmake |   65 ++++++++++++++++++++++++++++++++-------------
 1 file changed, 46 insertions(+), 19 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list