From: Viktor Szakats Date: Fri, 16 Aug 2024 23:41:23 +0000 (+0200) Subject: cmake: tidy up around ngtcp2 and wolfSSL X-Git-Tag: curl-8_10_0~214 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d2924653495eae06a3b6a1caa809f11e422e8c2;p=thirdparty%2Fcurl.git cmake: tidy up around ngtcp2 and wolfSSL - fix to add the `m` library without path. Follow-up to 8577f4ca084b8a3926b869a48a29d41a810eceb5 #14343 Authored-by: Tal Regev Fixes #14549 - move `m` library detection to wolfSSL Find module. `m` is necessary for wolfSSL (wolfcrypt) library functions called by `libngtcp2_crypto_wolfssl`. Follow-up to 8577f4ca084b8a3926b869a48a29d41a810eceb5 #14343 - fix comment header about supported `COMPONENT` names. - quote strings. - lowercase local variables. Closes #14576 --- diff --git a/CMake/FindNGTCP2.cmake b/CMake/FindNGTCP2.cmake index dfc6008aab..04bd59410c 100644 --- a/CMake/FindNGTCP2.cmake +++ b/CMake/FindNGTCP2.cmake @@ -26,10 +26,10 @@ # This module accepts optional COMPONENTS to control the crypto library (these are # mutually exclusive): # -# quictls, LibreSSL: Use libngtcp2_crypto_quictls -# BoringSSL, AWS-LC: Use libngtcp2_crypto_boringssl -# wolfSSL: Use libngtcp2_crypto_wolfssl -# GnuTLS: Use libngtcp2_crypto_gnutls +# quictls: Use libngtcp2_crypto_quictls (choose this for LibreSSL) +# BoringSSL: Use libngtcp2_crypto_boringssl (choose this for AWS-LC) +# wolfSSL: Use libngtcp2_crypto_wolfssl +# GnuTLS: Use libngtcp2_crypto_gnutls # # Result Variables: # diff --git a/CMake/FindWolfSSL.cmake b/CMake/FindWolfSSL.cmake index cea44b00a1..3189dc7c20 100644 --- a/CMake/FindWolfSSL.cmake +++ b/CMake/FindWolfSSL.cmake @@ -79,6 +79,13 @@ find_package_handle_standard_args(WolfSSL if(WOLFSSL_FOUND) set(WOLFSSL_INCLUDE_DIRS ${WOLFSSL_INCLUDE_DIR}) set(WOLFSSL_LIBRARIES ${WOLFSSL_LIBRARY}) + + if(NOT WIN32) + find_library(_math_library "m") + if(_math_library) + list(APPEND WOLFSSL_LIBRARIES "m") # for log and pow + endif() + endif() endif() mark_as_advanced(WOLFSSL_INCLUDE_DIR WOLFSSL_LIBRARY) diff --git a/CMakeLists.txt b/CMakeLists.txt index b72c7a871f..98fff8fdd6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -796,28 +796,25 @@ option(USE_NGTCP2 "Use ngtcp2 and nghttp3 libraries for HTTP/3 support" OFF) if(USE_NGTCP2) if(USE_OPENSSL OR USE_WOLFSSL) if(USE_WOLFSSL) - find_package(NGTCP2 REQUIRED wolfSSL) - if(NOT WIN32) - find_library(MATH_LIBRARY m) - endif() + find_package(NGTCP2 REQUIRED "wolfSSL") list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_wolfssl") elseif(HAVE_BORINGSSL OR HAVE_AWSLC) - find_package(NGTCP2 REQUIRED BoringSSL) + find_package(NGTCP2 REQUIRED "BoringSSL") list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_boringssl") else() - find_package(NGTCP2 REQUIRED quictls) + find_package(NGTCP2 REQUIRED "quictls") list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_quictls") endif() openssl_check_quic() elseif(USE_GNUTLS) - find_package(NGTCP2 REQUIRED GnuTLS) + find_package(NGTCP2 REQUIRED "GnuTLS") list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2_crypto_gnutls") else() message(FATAL_ERROR "ngtcp2 requires OpenSSL, wolfSSL or GnuTLS") endif() set(USE_NGTCP2 ON) include_directories(${NGTCP2_INCLUDE_DIRS}) - list(APPEND CURL_LIBS ${NGTCP2_LIBRARIES} ${MATH_LIBRARY}) + list(APPEND CURL_LIBS ${NGTCP2_LIBRARIES}) list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libngtcp2") find_package(NGHTTP3 REQUIRED)