From 486d2289faeaf79566d9b6331f041e5c5b457230 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Wed, 5 Apr 2023 16:31:20 +0200 Subject: [PATCH] cmake: remove fallback for crypto lib lookup because if a fallback happens, the WITH_(GCRYPT|MBEDTLS) variables do not match the selection, anymore. Also a silent fallback is pretty bad if it is unnoticed. Signed-off-by: Gregor Jasny Reviewed-by: Andreas Schneider --- CMakeLists.txt | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 57bc8b6b..9e3ab039 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,32 +49,16 @@ endif (WITH_ZLIB) if (WITH_GCRYPT) find_package(GCrypt 1.5.0 REQUIRED) - if (NOT GCRYPT_FOUND) - message(FATAL_ERROR "Could not find GCrypt") - endif (NOT GCRYPT_FOUND) elseif(WITH_MBEDTLS) find_package(MbedTLS REQUIRED) - if (NOT MBEDTLS_FOUND) - message(FATAL_ERROR "Could not find mbedTLS") - endif (NOT MBEDTLS_FOUND) -else (WITH_GCRYPT) - find_package(OpenSSL 1.1.1) - if (OPENSSL_FOUND) - # On CMake < 3.16, OPENSSL_CRYPTO_LIBRARIES is usually a synonym for OPENSSL_CRYPTO_LIBRARY, but is not defined - # when building on Windows outside of Cygwin. We provide the synonym here, if FindOpenSSL didn't define it already. - if (NOT DEFINED OPENSSL_CRYPTO_LIBRARIES) - set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) - endif (NOT DEFINED OPENSSL_CRYPTO_LIBRARIES) - else (OPENSSL_FOUND) - find_package(GCrypt) - if (NOT GCRYPT_FOUND) - find_package(MbedTLS) - if (NOT MBEDTLS_FOUND) - message(FATAL_ERROR "Could not find OpenSSL, GCrypt or mbedTLS") - endif (NOT MBEDTLS_FOUND) - endif (NOT GCRYPT_FOUND) - endif (OPENSSL_FOUND) -endif(WITH_GCRYPT) +else() + find_package(OpenSSL 1.1.1 REQUIRED) + # On CMake < 3.16, OPENSSL_CRYPTO_LIBRARIES is usually a synonym for OPENSSL_CRYPTO_LIBRARY, but is not defined + # when building on Windows outside of Cygwin. We provide the synonym here, if FindOpenSSL didn't define it already. + if (NOT DEFINED OPENSSL_CRYPTO_LIBRARIES) + set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) + endif (NOT DEFINED OPENSSL_CRYPTO_LIBRARIES) +endif() if (UNIT_TESTING) find_package(CMocka REQUIRED)