From 65a23739586e6cfb37f1f0365db7ab1ae6bc5712 Mon Sep 17 00:00:00 2001 From: sbiscigl Date: Fri, 26 Jan 2024 16:47:11 -0500 Subject: [PATCH] Sync FindCrypto. Add option to force crypto linkage --- CMakeLists.txt | 1 + cmake/Findcrypto.cmake | 9 ++++++++- docs/CMake_Parameters.md | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3908a46a28..4ea698774e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,7 @@ if (LEGACY_BUILD) option(BUILD_OPTEL_OTLP_BENCHMARKS "Enables building the benchmark tests with open telemetry OTLP clients" OFF) option(USE_TLS_V1_2 "Set http client to enforce TLS 1.2" ON) option(USE_TLS_V1_3 "Set http client to enforce TLS 1.3" OFF) + option(AWS_CRYPTO_BUILD_SHARED_LIBS "Forces FindCrypto to use a shared crypto library if found. regardless of the value of BUILD_SHARED_LIBS" OFF) set(AWS_USER_AGENT_CUSTOMIZATION "" CACHE STRING "User agent extension") set(AWS_TEST_REGION "US_EAST_1" CACHE STRING "Region to target integration tests against") diff --git a/cmake/Findcrypto.cmake b/cmake/Findcrypto.cmake index 5425280d74f..bf7d8b9025f 100644 --- a/cmake/Findcrypto.cmake +++ b/cmake/Findcrypto.cmake @@ -56,8 +56,15 @@ else() ) if (NOT crypto_LIBRARY) - if (BUILD_SHARED_LIBS) + if(${AWS_CRYPTO_BUILD_SHARED_LIBS}) + message(STATUS "forcing usage of shared crypto") set(crypto_LIBRARY ${crypto_SHARED_LIBRARY}) + elseif (BUILD_SHARED_LIBS) + if (crypto_SHARED_LIBRARY) + set(crypto_LIBRARY ${crypto_SHARED_LIBRARY}) + else() + set(crypto_LIBRARY ${crypto_STATIC_LIBRARY}) + endif() else() if (crypto_STATIC_LIBRARY) set(crypto_LIBRARY ${crypto_STATIC_LIBRARY}) diff --git a/docs/CMake_Parameters.md b/docs/CMake_Parameters.md index 4f9ac6ab2d3..b9b73abdc05 100644 --- a/docs/CMake_Parameters.md +++ b/docs/CMake_Parameters.md @@ -180,3 +180,6 @@ An override path for where the build system should find the Android NDK. By def ### ANDROID_BUILD_ZLIB (Defaults to ON) When building for Android, should Zlib be built as well + +### AWS_CRYPTO_BUILD_SHARED_LIBS +Forces FindCrypto to use a shared crypto library if found. regardless of the value of BUILD_SHARED_LIBS