cmake: tidy up around ngtcp2 and wolfSSL

- fix to add the `m` library without path.
  Follow-up to 8577f4ca08 #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 8577f4ca08 #14343

- fix comment header about supported `COMPONENT` names.

- quote strings.

- lowercase local variables.

Closes #14576
This commit is contained in:
Viktor Szakats 2024-08-17 01:41:23 +02:00
parent 24889acbfb
commit 1d29246534
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
3 changed files with 16 additions and 12 deletions

View File

@ -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:
#

View File

@ -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)

View File

@ -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)