curl set internal vars for mbedtls

This commit is contained in:
OatmealDome 2024-12-22 02:13:34 -05:00
parent 48b6e0a3e4
commit 06e5cfc13c
1 changed files with 20 additions and 7 deletions

View File

@ -7,29 +7,42 @@ set(BUILD_STATIC_LIBS ON)
set(BUILD_TESTS OFF)
set(CURL_ENABLE_EXPORT_TARGET OFF)
# Disable all dependencies except those that are vital (mbedtls).
set(HTTP_ONLY ON)
set(CURL_USE_LIBPSL OFF)
set(CURL_USE_LIBSSH2 OFF)
set(CURL_ZLIB OFF)
set(CURL_ZLIB OFF CACHE BOOL "" FORCE)
set(CURL_ZSTD OFF)
set(USE_LIBIDN2 OFF)
set(USE_NGHTTP2 OFF)
if(UNIX)
set(CURL_USE_MBEDTLS ON)
# We use mbedtls on Unix(-like) systems.
set(CURL_USE_OPENSSL OFF)
if(NOT MBEDTLS_FOUND)
set(MBEDTLS_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/Externals/mbedtls/include")
if(MBEDTLS_FOUND)
# There's mbedtls on the system, so we can just enable CURL_USE_MBEDTLS.
set(CURL_USE_MBEDTLS ON)
else()
# HACK: Set some internal variables to pretend like mbedtls was found on the system.
# We can't use CURL_USE_MBEDTLS with our copy from Externals, as that flag expects
# mbedtls to be installed (the CMakeLists attempts to search for it with find_package).
set(_ssl_enabled ON)
set(USE_MBEDTLS ON)
set(_curl_ca_bundle_supported TRUE)
endif()
endif()
if(WIN32)
set(USE_WIN32_LDAP OFF)
set(CURL_USE_SCHANNEL ON)
endif()
if(APPLE)
set(USE_APPLE_IDN ON)
endif()
add_subdirectory(curl)
if(UNIX AND NOT MBEDTLS_FOUND)
# HACK: Add the mbedtls include directory.
target_include_directories(libcurl_static PRIVATE "${CMAKE_SOURCE_DIR}/Externals/mbedtls/include")
endif()