Hi,

some applications only need the OpenSSL crypto library and want to avoid
linking against the SSL library, this is currently not possible. This
patch adds the variables OPENSSL_CRYPTO_LIBRARY and OPENSSL_SSL_LIBRARY
which are set to the respective library; this allows to be more specific
when linking against OpenSSL.

Cheers,

Hannes

From 820599eda8a5a0c8a7eaa05f8e4cdf7d5819bfcf Mon Sep 17 00:00:00 2001
From: Hannes Mezger <[email protected]>
Date: Fri, 28 Nov 2014 15:21:53 +0100
Subject: [PATCH] Add variables OPENSSL_CRYPTO_LIBRARY and OPENSSL_SSL_LIBRARY

Some applications only need the OpenSSL crypto library and want to avoid 
linking against the SSL library, this is currently not possible. This patch 
adds the variables OPENSSL_CRYPTO_LIBRARY and OPENSSL_SSL_LIBRARY which are set 
to the respective library; this allows to be more specific when linking against 
OpenSSL.
---
 Modules/FindOpenSSL.cmake | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 340b417..175ac70 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -16,10 +16,12 @@
 #
 # ::
 #
-#   OPENSSL_FOUND - system has the OpenSSL library
-#   OPENSSL_INCLUDE_DIR - the OpenSSL include directory
-#   OPENSSL_LIBRARIES - The libraries needed to use OpenSSL
-#   OPENSSL_VERSION - This is set to $major.$minor.$revision$path (eg. 0.9.8s)
+#   OPENSSL_FOUND - System has the OpenSSL library
+#   OPENSSL_INCLUDE_DIR - The OpenSSL include directory
+#   OPENSSL_CRYPTO_LIBRARY - The OpenSSL crypto library
+#   OPENSSL_SSL_LIBRARY - The OpenSSL SSL library
+#   OPENSSL_LIBRARIES - All OpenSSL libraries
+#   OPENSSL_VERSION - This is set to $major.$minor.$revision$patch (eg. 0.9.8s)
 
 #=============================================================================
 # Copyright 2006-2009 Kitware, Inc.
@@ -153,6 +155,8 @@ if(WIN32 AND NOT CYGWIN)
 
     mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE
                      SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE)
+    set( OPENSSL_SSL_LIBRARY ${SSL_EAY_LIBRARY} )
+    set( OPENSSL_CRYPTO_LIBRARY ${LIB_EAY_LIBRARY} )
     set( OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} )
   elseif(MINGW)
     # same player, for MinGW
@@ -181,6 +185,8 @@ if(WIN32 AND NOT CYGWIN)
     )
 
     mark_as_advanced(SSL_EAY LIB_EAY)
+    set( OPENSSL_SSL_LIBRARY ${SSL_EAY} )
+    set( OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} )
     set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
     unset(LIB_EAY_NAMES)
     unset(SSL_EAY_NAMES)
@@ -207,6 +213,8 @@ if(WIN32 AND NOT CYGWIN)
     )
 
     mark_as_advanced(SSL_EAY LIB_EAY)
+    set( OPENSSL_SSL_LIBRARY ${SSL_EAY} )
+    set( OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} )
     set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
   endif()
 else()
@@ -331,4 +339,4 @@ else ()
   )
 endif ()
 
-mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)
+mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES OPENSSL_SSL_LIBRARY 
OPENSSL_CRYPTO_LIBRARY)
-- 
1.9.4.msysgit.0

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to