From 0e3cac2efd2b89ff68555acac4fa909b9941aeed Mon Sep 17 00:00:00 2001 From: Andarwinux Date: Thu, 23 May 2024 00:00:00 +0000 Subject: [PATCH] Allow add extra libraries for OpenSSL Some platforms such as MSYS2 provide a broken libcrypto.pc, this is needed to fix statically link build. --- Configure.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Configure.cmake b/Configure.cmake index 19a153f0..3e66136e 100644 --- a/Configure.cmake +++ b/Configure.cmake @@ -11,6 +11,7 @@ if (SLEEF_BUILD_STATIC_TEST_BINS) set(CMAKE_EXE_LINKER_FLAGS "-static") endif() +set(OPENSSL_EXTRA_LIBRARIES "" CACHE STRING "Extra libraries for openssl") if (NOT CMAKE_CROSSCOMPILING AND NOT SLEEF_FORCE_FIND_PACKAGE_SSL) find_package(OpenSSL) if (OPENSSL_FOUND) @@ -24,6 +25,7 @@ if (NOT CMAKE_CROSSCOMPILING AND NOT SLEEF_FORCE_FIND_PACKAGE_SSL) SLEEF_OPENSSL_LIBRARIES "${OPENSSL_LIBRARIES}") endif() set(SLEEF_OPENSSL_VERSION ${OPENSSL_VERSION}) + set(SLEEF_OPENSSL_LIBRARIES ${SLEEF_OPENSSL_LIBRARIES} ${OPENSSL_EXTRA_LIBRARIES}) set(SLEEF_OPENSSL_INCLUDE_DIR ${OPENSSL_INCLUDE_DIR}) endif() else() @@ -32,7 +34,7 @@ else() find_library(LIBCRYPTO crypto) if (LIBSSL AND LIBCRYPTO) set(SLEEF_OPENSSL_FOUND TRUE) - set(SLEEF_OPENSSL_LIBRARIES ${LIBSSL} ${LIBCRYPTO}) + set(SLEEF_OPENSSL_LIBRARIES ${LIBSSL} ${LIBCRYPTO} ${OPENSSL_EXTRA_LIBRARIES}) set(SLEEF_OPENSSL_VERSION ${LIBSSL}) endif() endif()