Fix case: HTTPLIB_REQUIRE_OPENSSL=OFF; HTTPLIB_REQUIRE_MBEDTLS=ON
This commit is contained in:
Matheus Gabriel Werny
2026-02-11 14:46:36 +01:00
parent 6f34a08c6e
commit 8682189e59

View File

@@ -126,6 +126,7 @@ else()
endif() endif()
endif() endif()
# Incompatibility between OpenSSL and MbedTLS
if(HTTPLIB_REQUIRE_OPENSSL AND HTTPLIB_REQUIRE_MBEDTLS) if(HTTPLIB_REQUIRE_OPENSSL AND HTTPLIB_REQUIRE_MBEDTLS)
message(FATAL_ERROR "HTTPLIB_REQUIRE_OPENSSL and HTTPLIB_REQUIRE_MBEDTLS are mutually exclusive.") message(FATAL_ERROR "HTTPLIB_REQUIRE_OPENSSL and HTTPLIB_REQUIRE_MBEDTLS are mutually exclusive.")
endif() endif()
@@ -134,6 +135,10 @@ if(HTTPLIB_USE_OPENSSL_IF_AVAILABLE AND HTTPLIB_USE_MBEDTLS_IF_AVAILABLE)
message(FATAL_ERROR "HTTPLIB_USE_OPENSSL_IF_AVAILABLE and HTTPLIB_USE_MBEDTLS_IF_AVAILABLE are mutually exclusive.") message(FATAL_ERROR "HTTPLIB_USE_OPENSSL_IF_AVAILABLE and HTTPLIB_USE_MBEDTLS_IF_AVAILABLE are mutually exclusive.")
endif() endif()
if(HTTPLIB_REQUIRE_MBEDTLS)
set(HTTPLIB_USE_OPENSSL_IF_AVAILABLE OFF)
endif()
# Defaults to static library but respects standard BUILD_SHARED_LIBS if set # Defaults to static library but respects standard BUILD_SHARED_LIBS if set
include(CMakeDependentOption) include(CMakeDependentOption)
cmake_dependent_option(HTTPLIB_SHARED "Build the library as a shared library instead of static. Has no effect if using header-only." cmake_dependent_option(HTTPLIB_SHARED "Build the library as a shared library instead of static. Has no effect if using header-only."
@@ -192,7 +197,6 @@ if(HTTPLIB_REQUIRE_MBEDTLS)
set(HTTPLIB_IS_USING_MBEDTLS TRUE) set(HTTPLIB_IS_USING_MBEDTLS TRUE)
elseif(HTTPLIB_USE_MBEDTLS_IF_AVAILABLE) elseif(HTTPLIB_USE_MBEDTLS_IF_AVAILABLE)
find_package(MbedTLS QUIET) find_package(MbedTLS QUIET)
message(WARNING ${MbedTLS_FOUND}) # TODO
set(HTTPLIB_IS_USING_MBEDTLS ${MbedTLS_FOUND}) set(HTTPLIB_IS_USING_MBEDTLS ${MbedTLS_FOUND})
endif() endif()