From 76d49fef9965d1a219ba388a502cff751caa5365 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 | 2 ++ cmake/Findcrypto.cmake | 12 +++++++++++- docs/CMake_Parameters.md | 6 ++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3908a46a28..5387561c863 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,8 @@ 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(FORCE_SHARED_CRYPTO "Forces FindCrypto to use a shared crypto library if found. regardless of the value of BUILD_SHARED_LIBS" OFF) + option(FORCE_STATIC_CRYPTO "Forces FindCrypto to use a static 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..230b0cb0f1e 100644 --- a/cmake/Findcrypto.cmake +++ b/cmake/Findcrypto.cmake @@ -56,8 +56,18 @@ else() ) if (NOT crypto_LIBRARY) - if (BUILD_SHARED_LIBS) + if(${FORCE_SHARED_CRYPTO}) + message(STATUS "forcing usage of shared crypto") set(crypto_LIBRARY ${crypto_SHARED_LIBRARY}) + elseif (${FORCE_STATIC_CRYPTO}) + message(STATUS "forcing usage of static crypto") + set(crypto_LIBRARY ${crypto_STATIC_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..5362ba2dba2 100644 --- a/docs/CMake_Parameters.md +++ b/docs/CMake_Parameters.md @@ -180,3 +180,9 @@ 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 + +### FORCE_SHARED_CRYPTO +Forces FindCrypto to use a shared crypto library if found. regardless of the value of BUILD_SHARED_LIBS + +### FORCE_STATIC_CRYPTO +Forces FindCrypto to use a static crypto library if found. regardless of the value of BUILD_SHARED_LIBS