From 9dc0770e2c19403d2ae173749587c7861a8f5dbc Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 11 Sep 2024 23:42:43 +0200 Subject: [PATCH] cmake: ensure `CURL_USE_OPENSSL`/`USE_OPENSSL_QUIC` are set in sync 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f8e9c25ebc..18eb6b823f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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!") -- 2.47.3