]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: tidy up around ngtcp2 and wolfSSL
authorViktor Szakats <commit@vsz.me>
Fri, 16 Aug 2024 23:41:23 +0000 (01:41 +0200)
committerViktor Szakats <commit@vsz.me>
Sun, 18 Aug 2024 09:17:20 +0000 (11:17 +0200)
- 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

CMake/FindNGTCP2.cmake
CMake/FindWolfSSL.cmake
CMakeLists.txt

index dfc6008aab9b809c9405ba8cab14cf37fbb4b200..04bd59410cab29447c31f41769ca767762417ec5 100644 (file)
 # 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:
 #
index cea44b00a1e6ffae511e17ea34970e74f23128c3..3189dc7c20fc222edc7013899cfc59a28f67f4ae 100644 (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)
index b72c7a871f1f097e3ac9f7c21a681c6f13ed2ec4..98fff8fdd643d8597e20b664c0a2eae232bb911f 100644 (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)