]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: ensure `CURL_USE_OPENSSL`/`USE_OPENSSL_QUIC` are set in sync
authorViktor Szakats <commit@vsz.me>
Wed, 11 Sep 2024 21:42:43 +0000 (23:42 +0200)
committerViktor Szakats <commit@vsz.me>
Thu, 12 Sep 2024 10:53:50 +0000 (12:53 +0200)
OpenSSL must be selected (manually or by default) and detected for
`USE_OPENSSL_QUIC=ON` to work. This was documented before this patch,
but with CMake it was possible to use `USE_OPENSSL_QUIC=ON` without
an explicit or default `CURL_USE_OPENSSL=ON`, leading to a confused
internal state.

Fix by checking the QUIC condition early, showing a warning if enabled
without OpenSSL, and ignoring QUIC in such case.

Also: Fix casing of OpenSSL in option description.

Ref: #14866
Closes #14872

CMakeLists.txt

index f8e9c25ebc976bdee3286c50e17c9ba382d395e7..18eb6b823f60d59c7a72ac7ce603ee08062ecf3e 100644 (file)
@@ -505,6 +505,11 @@ if(WIN32 OR CURL_USE_SECTRANSP OR CURL_USE_SCHANNEL OR CURL_USE_MBEDTLS OR CURL_
   set(_openssl_default OFF)
 endif()
 cmake_dependent_option(CURL_USE_OPENSSL "Enable OpenSSL for SSL/TLS" ${_openssl_default} CURL_ENABLE_SSL OFF)
+option(USE_OPENSSL_QUIC "Use OpenSSL and nghttp3 libraries for HTTP/3 support" OFF)
+if(USE_OPENSSL_QUIC AND NOT CURL_USE_OPENSSL)
+  message(WARNING "OpenSSL QUIC has been requested, but without enabling OpenSSL. Will not enable QUIC.")
+  set(USE_OPENSSL_QUIC OFF)
+endif()
 option(CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG "Disable automatic loading of OpenSSL configuration" OFF)
 
 count_true(_enabled_ssl_options_count
@@ -900,7 +905,6 @@ if(USE_MSH3)
   list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libmsh3")
 endif()
 
-option(USE_OPENSSL_QUIC "Use openssl and nghttp3 libraries for HTTP/3 support" OFF)
 if(USE_OPENSSL_QUIC)
   if(USE_NGTCP2 OR USE_QUICHE OR USE_MSH3)
     message(FATAL_ERROR "Only one HTTP/3 backend can be selected!")