|
| 1 | +From 0dd486ba596fea07742a9317542bce27e18fd830 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Alexander Kanavin < [email protected]> |
| 3 | +Date: Mon, 9 Apr 2018 18:02:56 +0300 |
| 4 | +Subject: [PATCH] Link dynamic libraries with their library dependencies. |
| 5 | + |
| 6 | +It does seem like outside of OpenBSD, no one has actually used libressl yet. |
| 7 | + |
| 8 | +Upstream-Status: Pending |
| 9 | +Signed-off-by: Alexander Kanavin < [email protected]> |
| 10 | + |
| 11 | +--- |
| 12 | + CMakeLists.txt | 5 +++++ |
| 13 | + crypto/CMakeLists.txt | 1 + |
| 14 | + ssl/CMakeLists.txt | 2 +- |
| 15 | + 3 files changed, 7 insertions(+), 1 deletion(-) |
| 16 | + |
| 17 | +diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 18 | +index 549849f..0f9d8f5 100644 |
| 19 | +--- a/CMakeLists.txt |
| 20 | ++++ b/CMakeLists.txt |
| 21 | +@@ -266,15 +266,19 @@ set(OPENSSL_LIBS tls ssl crypto) |
| 22 | + |
| 23 | + # Add additional required libs |
| 24 | + if(WIN32) |
| 25 | ++ set(OPENSSL_LIB_LIBS ws2_32) |
| 26 | + set(OPENSSL_LIBS ${OPENSSL_LIBS} ws2_32) |
| 27 | + endif() |
| 28 | + if(CMAKE_SYSTEM_NAME MATCHES "Linux") |
| 29 | ++ set(OPENSSL_LIB_LIBS pthread) |
| 30 | + set(OPENSSL_LIBS ${OPENSSL_LIBS} pthread) |
| 31 | + endif() |
| 32 | + if(CMAKE_SYSTEM_NAME MATCHES "HP-UX") |
| 33 | ++ set(OPENSSL_LIB_LIBS pthread) |
| 34 | + set(OPENSSL_LIBS ${OPENSSL_LIBS} pthread) |
| 35 | + endif() |
| 36 | + if(CMAKE_SYSTEM_NAME MATCHES "SunOS") |
| 37 | ++ set(OPENSSL_LIB_LIBS nsl socket) |
| 38 | + set(OPENSSL_LIBS ${OPENSSL_LIBS} nsl socket) |
| 39 | + endif() |
| 40 | + |
| 41 | +@@ -282,6 +286,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux") |
| 42 | + # Check if we need -lrt to get clock_gettime on Linux |
| 43 | + check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME) |
| 44 | + if (HAVE_CLOCK_GETTIME) |
| 45 | ++ set(OPENSSL_LIB_LIBS ${OPENSSL_LIB_LIBS} rt) |
| 46 | + set(OPENSSL_LIBS ${OPENSSL_LIBS} rt) |
| 47 | + endif() |
| 48 | + else() |
| 49 | +diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt |
| 50 | +index 90e127e..08eceda 100644 |
| 51 | +--- a/crypto/CMakeLists.txt |
| 52 | ++++ b/crypto/CMakeLists.txt |
| 53 | +@@ -813,6 +813,7 @@ target_include_directories(crypto |
| 54 | + ../include) |
| 55 | + |
| 56 | + if (BUILD_SHARED_LIBS) |
| 57 | ++ target_link_libraries(crypto ${OPENSSL_LIB_LIBS}) |
| 58 | + export_symbol(crypto ${CMAKE_CURRENT_BINARY_DIR}/crypto_p.sym) |
| 59 | + if (WIN32) |
| 60 | + target_link_libraries(crypto Ws2_32.lib) |
| 61 | +diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt |
| 62 | +index 1a559e6..ed17223 100644 |
| 63 | +--- a/ssl/CMakeLists.txt |
| 64 | ++++ b/ssl/CMakeLists.txt |
| 65 | +@@ -51,7 +51,7 @@ target_include_directories(ssl |
| 66 | + |
| 67 | + if (BUILD_SHARED_LIBS) |
| 68 | + export_symbol(ssl ${CMAKE_CURRENT_SOURCE_DIR}/ssl.sym) |
| 69 | +- target_link_libraries(ssl crypto) |
| 70 | ++ target_link_libraries(ssl crypto ${OPENSSL_LIB_LIBS}) |
| 71 | + if (WIN32) |
| 72 | + target_link_libraries(ssl Ws2_32.lib) |
| 73 | + set(SSL_POSTFIX -${SSL_MAJOR_VERSION}) |
0 commit comments