Re: [cmake-developers] FindOpenSSL: Link libraries needed for static OpenSSL.

2016-08-17 Thread Rolf Eike Beer

Am 2016-08-17 14:53, schrieb Brad King:

On 08/16/2016 04:44 PM, Alexander Lamaison wrote:
I've attached a new patch without the changes to the singular-named 
variables.


Thanks.


+if(WIN32 AND NOT CYGWIN)
+  set_target_properties(OpenSSL::Crypto PROPERTIES
+INTERFACE_LINK_LIBRARIES crypt32)
+else()
+  set_target_properties(OpenSSL::Crypto PROPERTIES
+INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS}")
+endif()


The addition of crypt32/dl is done with this logic in several places.
Instead please use a _OPENSSL_LIBRARY_DEPENDS variable to hold the
value and then reference it in the other locations so that the
conditions for setting it do not have to be duplicated.


Don't forget to unset() the variable at the end of the module.

Greetings,

Eike
--

--

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


Re: [cmake-developers] FindOpenSSL: Link libraries needed for static OpenSSL.

2016-08-17 Thread Brad King
On 08/16/2016 04:44 PM, Alexander Lamaison wrote:
> I've attached a new patch without the changes to the singular-named variables.

Thanks.

> +if(WIN32 AND NOT CYGWIN)
> +  set_target_properties(OpenSSL::Crypto PROPERTIES
> +INTERFACE_LINK_LIBRARIES crypt32)
> +else()
> +  set_target_properties(OpenSSL::Crypto PROPERTIES
> +INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS}")
> +endif()

The addition of crypt32/dl is done with this logic in several places.
Instead please use a _OPENSSL_LIBRARY_DEPENDS variable to hold the
value and then reference it in the other locations so that the
conditions for setting it do not have to be duplicated.

Thanks,
-Brad

-- 

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


Re: [cmake-developers] FindOpenSSL: Link libraries needed for static OpenSSL.

2016-08-16 Thread Alexander Lamaison
On 15 August 2016 at 14:25, Brad King  wrote:
> On 08/14/2016 01:58 PM, Alexander Lamaison wrote:
>> This patch updates FindOpenSSL.cmake to include the necessary system
>> libs in the OpenSSL libraries variables and in the OpenSSL::Crypto and
>> OpenSSL::SSL target properties.
>
> Thanks.  The singluar-named OPENSSL_{SSL,CRYPTO}_LIBRARY variables
> are meant just to hold the specific library files (i.e. the result
> of one find_library call).  Instead of placing the dependencies
> directly in them we should have other (internal) variables to hold
> them.  That will also avoid duplicating conditions for filling in
> the imported target information.


I've attached a new patch without the changes to the singular-named variables.

Alex
From e6cca7701b9b04507ec9d1a054dcc6f3652b61bb Mon Sep 17 00:00:00 2001
From: Alexander Lamaison 
Date: Tue, 16 Aug 2016 21:23:57 +0100
Subject: [PATCH] FindOpenSSL: Link libraries needed for static OpenSSL.

OpenSSL depends on system libraries.  When linking statically again
OpenSSL, the client target must also link those libraries.

This patch updates FindOpenSSL.cmake to include the necessary system
libs in the OpenSSL libraries variables and in the OpenSSL::Crypto and
OpenSSL::SSL target properties.

The dependencies:
Windows: crypt32
Unix: CMAKE_DL_LIBS
---
 Modules/FindOpenSSL.cmake | 25 +++--
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 10b62ff..ac55416 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -201,7 +201,7 @@ if(WIN32 AND NOT CYGWIN)
  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} )
+set(OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} crypt32)
   elseif(MINGW)
 # same player, for MinGW
 set(LIB_EAY_NAMES crypto libeay32)
@@ -229,7 +229,7 @@ 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} )
+set(OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} crypt32)
 unset(LIB_EAY_NAMES)
 unset(SSL_EAY_NAMES)
   else()
@@ -259,7 +259,7 @@ 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} )
+set(OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} crypt32)
   endif()
 else()
 
@@ -290,10 +290,10 @@ else()
   mark_as_advanced(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY)
 
   # compat defines
-  set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY})
-  set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
+  set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${CMAKE_DL_LIBS})
+  set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY} ${CMAKE_DL_LIBS})
 
-  set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
+  set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${CMAKE_DL_LIBS})
 
 endif()
 
@@ -394,6 +394,13 @@ if(OPENSSL_FOUND)
 add_library(OpenSSL::Crypto UNKNOWN IMPORTED)
 set_target_properties(OpenSSL::Crypto PROPERTIES
   INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}")
+if(WIN32 AND NOT CYGWIN)
+  set_target_properties(OpenSSL::Crypto PROPERTIES
+INTERFACE_LINK_LIBRARIES crypt32)
+else()
+  set_target_properties(OpenSSL::Crypto PROPERTIES
+INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS}")
+endif()
 if(EXISTS "${OPENSSL_CRYPTO_LIBRARY}")
   set_target_properties(OpenSSL::Crypto PROPERTIES
 IMPORTED_LINK_INTERFACE_LANGUAGES "C"
@@ -445,6 +452,12 @@ if(OPENSSL_FOUND)
   set_target_properties(OpenSSL::SSL PROPERTIES
 INTERFACE_LINK_LIBRARIES OpenSSL::Crypto)
 endif()
+if(WIN32 AND NOT CYGWIN)
+  set_property(TARGET OpenSSL::SSL APPEND PROPERTY
+	INTERFACE_LINK_LIBRARIES crypt32)
+else()
+  set_property(TARGET OpenSSL::SSL APPEND PROPERTY
+	INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS}")
   endif()
 endif()
 
-- 
2.9.2

-- 

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

Re: [cmake-developers] FindOpenSSL: Link libraries needed for static OpenSSL.

2016-08-15 Thread Brad King
On 08/14/2016 01:58 PM, Alexander Lamaison wrote:
> This patch updates FindOpenSSL.cmake to include the necessary system
> libs in the OpenSSL libraries variables and in the OpenSSL::Crypto and
> OpenSSL::SSL target properties.

Thanks.  The singluar-named OPENSSL_{SSL,CRYPTO}_LIBRARY variables
are meant just to hold the specific library files (i.e. the result
of one find_library call).  Instead of placing the dependencies
directly in them we should have other (internal) variables to hold
them.  That will also avoid duplicating conditions for filling in
the imported target information.

-Brad

-- 

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


[cmake-developers] FindOpenSSL: Link libraries needed for static OpenSSL.

2016-08-14 Thread Alexander Lamaison
OpenSSL depends on system libraries.  When linking statically again
OpenSSL, the client target must also link those libraries.

This patch updates FindOpenSSL.cmake to include the necessary system
libs in the OpenSSL libraries variables and in the OpenSSL::Crypto and
OpenSSL::SSL target properties.

The dependencies:
Windows: crypt32
Unix: CMAKE_DL_LIBS
From 4c1332675ad6b8bce360285869b90d4302735d5b Mon Sep 17 00:00:00 2001
From: Alexander Lamaison 
Date: Sun, 14 Aug 2016 18:45:46 +0100
Subject: [PATCH] FindOpenSSL: Link libraries needed for static OpenSSL.

OpenSSL depends on system libraries.  When linking statically again
OpenSSL, the client target must also link those libraries.

This patch updates FindOpenSSL.cmake to include the necessary system
libs in the OpenSSL libraries variables and in the OpenSSL::Crypto and
OpenSSL::SSL target properties.

The dependencies:
Windows: crypt32
Unix: CMAKE_DL_LIBS
---
 Modules/FindOpenSSL.cmake | 37 +
 1 file changed, 25 insertions(+), 12 deletions(-)

diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 10b62ff..275d283 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -199,9 +199,9 @@ 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} )
+set(OPENSSL_SSL_LIBRARY ${SSL_EAY_LIBRARY} crypt32)
+set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY_LIBRARY} crypt32)
+set(OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} crypt32)
   elseif(MINGW)
 # same player, for MinGW
 set(LIB_EAY_NAMES crypto libeay32)
@@ -227,9 +227,9 @@ 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} )
+set(OPENSSL_SSL_LIBRARY ${SSL_EAY} crypt32)
+set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} crypt32)
+set(OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} crypt32)
 unset(LIB_EAY_NAMES)
 unset(SSL_EAY_NAMES)
   else()
@@ -257,9 +257,9 @@ 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} )
+set(OPENSSL_SSL_LIBRARY ${SSL_EAY} crypt32)
+set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} crypt32)
+set(OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} crypt32)
   endif()
 else()
 
@@ -290,10 +290,10 @@ else()
   mark_as_advanced(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY)
 
   # compat defines
-  set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY})
-  set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
+  set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${CMAKE_DL_LIBS})
+  set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY} ${CMAKE_DL_LIBS})
 
-  set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
+  set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${CMAKE_DL_LIBS})
 
 endif()
 
@@ -394,6 +394,13 @@ if(OPENSSL_FOUND)
 add_library(OpenSSL::Crypto UNKNOWN IMPORTED)
 set_target_properties(OpenSSL::Crypto PROPERTIES
   INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}")
+if(WIN32 AND NOT CYGWIN)
+  set_target_properties(OpenSSL::Crypto PROPERTIES
+INTERFACE_LINK_LIBRARIES crypt32)
+else()
+  set_target_properties(OpenSSL::Crypto PROPERTIES
+INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS}")
+endif()
 if(EXISTS "${OPENSSL_CRYPTO_LIBRARY}")
   set_target_properties(OpenSSL::Crypto PROPERTIES
 IMPORTED_LINK_INTERFACE_LANGUAGES "C"
@@ -445,6 +452,12 @@ if(OPENSSL_FOUND)
   set_target_properties(OpenSSL::SSL PROPERTIES
 INTERFACE_LINK_LIBRARIES OpenSSL::Crypto)
 endif()
+if(WIN32 AND NOT CYGWIN)
+  set_property(TARGET OpenSSL::SSL APPEND PROPERTY
+	INTERFACE_LINK_LIBRARIES crypt32)
+else()
+  set_property(TARGET OpenSSL::SSL APPEND PROPERTY
+	INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS}")
   endif()
 endif()
 
-- 
2.9.2

-- 

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