|
|
@@ -1,4 +1,5 @@
|
|
|
# Set curl options as needed for CMake build
|
|
|
+set(_CURL_QUICK_DETECT ON)
|
|
|
set(BUILD_CURL_EXE OFF CACHE INTERNAL "No curl exe")
|
|
|
set(BUILD_DASHBOARD_REPORTS OFF CACHE INTERNAL "No curl dashboard reports")
|
|
|
set(BUILD_RELEASE_DEBUG_DIRS OFF CACHE INTERNAL "No curl release/debug dirs")
|
|
|
@@ -235,13 +236,13 @@ if(NOT "$ENV{CURL_BUILDINFO}$ENV{CURL_CI}$ENV{CI}" STREQUAL "")
|
|
|
else()
|
|
|
set(_cache_var_type ":${_cache_var_type}")
|
|
|
endif()
|
|
|
- set(_cmake_args "${_cmake_args} -D${_cache_var}${_cache_var_type}=\"${_cache_var_value}\"")
|
|
|
+ string(APPEND _cmake_args " -D${_cache_var}${_cache_var_type}=\"${_cache_var_value}\"")
|
|
|
endif()
|
|
|
endforeach()
|
|
|
endif()
|
|
|
endif() # XXX(cmake): end
|
|
|
|
|
|
-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
|
|
|
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
|
|
|
include(Utilities)
|
|
|
include(Macros)
|
|
|
include(CMakeDependentOption)
|
|
|
@@ -289,49 +290,49 @@ endif()
|
|
|
|
|
|
set(_target_flags "")
|
|
|
if(APPLE)
|
|
|
- set(_target_flags "${_target_flags} APPLE")
|
|
|
+ string(APPEND _target_flags " APPLE")
|
|
|
endif()
|
|
|
if(UNIX)
|
|
|
- set(_target_flags "${_target_flags} UNIX")
|
|
|
+ string(APPEND _target_flags " UNIX")
|
|
|
endif()
|
|
|
if(BSD)
|
|
|
- set(_target_flags "${_target_flags} BSD")
|
|
|
+ string(APPEND _target_flags " BSD")
|
|
|
endif()
|
|
|
if(ANDROID)
|
|
|
- set(_target_flags "${_target_flags} ANDROID-${ANDROID_PLATFORM_LEVEL}")
|
|
|
+ string(APPEND _target_flags " ANDROID-${ANDROID_PLATFORM_LEVEL}")
|
|
|
endif()
|
|
|
if(WIN32)
|
|
|
- set(_target_flags "${_target_flags} WIN32")
|
|
|
+ string(APPEND _target_flags " WIN32")
|
|
|
endif()
|
|
|
if(WINDOWS_STORE)
|
|
|
- set(_target_flags "${_target_flags} UWP")
|
|
|
+ string(APPEND _target_flags " UWP")
|
|
|
endif()
|
|
|
if(CYGWIN)
|
|
|
- set(_target_flags "${_target_flags} CYGWIN")
|
|
|
+ string(APPEND _target_flags " CYGWIN")
|
|
|
endif()
|
|
|
if(MSYS)
|
|
|
- set(_target_flags "${_target_flags} MSYS")
|
|
|
+ string(APPEND _target_flags " MSYS")
|
|
|
endif()
|
|
|
if(DOS)
|
|
|
- set(_target_flags "${_target_flags} DOS")
|
|
|
+ string(APPEND _target_flags " DOS")
|
|
|
endif()
|
|
|
if(AMIGA)
|
|
|
- set(_target_flags "${_target_flags} AMIGA")
|
|
|
+ string(APPEND _target_flags " AMIGA")
|
|
|
endif()
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
- set(_target_flags "${_target_flags} GCC")
|
|
|
+ string(APPEND _target_flags " GCC")
|
|
|
endif()
|
|
|
if(MINGW)
|
|
|
- set(_target_flags "${_target_flags} MINGW")
|
|
|
+ string(APPEND _target_flags " MINGW")
|
|
|
endif()
|
|
|
if(MSVC)
|
|
|
- set(_target_flags "${_target_flags} MSVC-${MSVC_VERSION}")
|
|
|
+ string(APPEND _target_flags " MSVC-${MSVC_VERSION}")
|
|
|
endif()
|
|
|
if(VCPKG_TOOLCHAIN)
|
|
|
- set(_target_flags "${_target_flags} VCPKG")
|
|
|
+ string(APPEND _target_flags " VCPKG")
|
|
|
endif()
|
|
|
if(CMAKE_CROSSCOMPILING)
|
|
|
- set(_target_flags "${_target_flags} CROSS")
|
|
|
+ string(APPEND _target_flags " CROSS")
|
|
|
endif()
|
|
|
if(0) # XXX(cmake): not needed for build within cmake
|
|
|
message(STATUS "CMake platform flags:${_target_flags}")
|
|
|
@@ -379,8 +380,8 @@ if(WIN32)
|
|
|
option(CURL_STATIC_CRT "Build libcurl with static CRT with MSVC (/MT)" OFF)
|
|
|
if(CURL_STATIC_CRT AND MSVC)
|
|
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
|
|
- set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -MT")
|
|
|
- set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -MTd")
|
|
|
+ string(APPEND CMAKE_C_FLAGS_RELEASE " -MT")
|
|
|
+ string(APPEND CMAKE_C_FLAGS_DEBUG " -MTd")
|
|
|
endif()
|
|
|
|
|
|
option(ENABLE_UNICODE "Use the Unicode version of the Windows API functions" OFF)
|
|
|
@@ -395,7 +396,11 @@ if(WIN32)
|
|
|
endif()
|
|
|
|
|
|
if(0) # XXX(cmake): not needed for build within cmake
|
|
|
- list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DWIN32_LEAN_AND_MEAN") # Apply to all feature checks
|
|
|
+ # Apply to all feature checks
|
|
|
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DWIN32_LEAN_AND_MEAN")
|
|
|
+ if(MSVC)
|
|
|
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_CRT_NONSTDC_NO_DEPRECATE") # for strdup() detection
|
|
|
+ endif()
|
|
|
|
|
|
set(CURL_TARGET_WINDOWS_VERSION "" CACHE STRING "Minimum target Windows version as hex string")
|
|
|
if(CURL_TARGET_WINDOWS_VERSION)
|
|
|
@@ -446,7 +451,7 @@ include(PickyWarnings)
|
|
|
endif() # XXX(cmake): end
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE") # Required for sendmmsg()
|
|
|
+ string(APPEND CMAKE_C_FLAGS " -D_GNU_SOURCE") # Required for sendmmsg()
|
|
|
endif()
|
|
|
|
|
|
option(ENABLE_DEBUG "Enable curl debug features (for developing curl itself)" OFF)
|
|
|
@@ -455,10 +460,6 @@ if(ENABLE_DEBUG)
|
|
|
endif()
|
|
|
option(ENABLE_CURLDEBUG "Enable TrackMemory debug feature" ${ENABLE_DEBUG})
|
|
|
|
|
|
-if(MSVC)
|
|
|
- set(ENABLE_CURLDEBUG OFF) # FIXME: TrackMemory + MSVC fails test 558 and 1330. Tested with static build, Debug mode.
|
|
|
-endif()
|
|
|
-
|
|
|
if(ENABLE_DEBUG)
|
|
|
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "DEBUGBUILD")
|
|
|
endif()
|
|
|
@@ -542,7 +543,7 @@ if(ENABLE_ARES)
|
|
|
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${CARES_PC_REQUIRES})
|
|
|
link_directories(${CARES_LIBRARY_DIRS})
|
|
|
if(CARES_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CARES_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${CARES_CFLAGS}")
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
|
@@ -679,35 +680,6 @@ if(WINDOWS_STORE)
|
|
|
set(CURL_DISABLE_TELNET ON) # telnet code needs fixing to compile for UWP.
|
|
|
endif()
|
|
|
|
|
|
-option(ENABLE_IPV6 "Enable IPv6 support" ON)
|
|
|
-mark_as_advanced(ENABLE_IPV6)
|
|
|
-if(ENABLE_IPV6 AND NOT WIN32)
|
|
|
- include(CheckStructHasMember)
|
|
|
- check_struct_has_member("struct sockaddr_in6" "sin6_addr" "netinet/in.h" HAVE_SOCKADDR_IN6_SIN6_ADDR)
|
|
|
- check_struct_has_member("struct sockaddr_in6" "sin6_scope_id" "netinet/in.h" HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID)
|
|
|
- if(NOT HAVE_SOCKADDR_IN6_SIN6_ADDR)
|
|
|
- if(NOT DOS AND NOT AMIGA)
|
|
|
- message(WARNING "struct sockaddr_in6 not available, disabling IPv6 support")
|
|
|
- endif()
|
|
|
- # Force the feature off as this name is used as guard macro...
|
|
|
- set(ENABLE_IPV6 OFF CACHE BOOL "Enable IPv6 support" FORCE)
|
|
|
- endif()
|
|
|
-
|
|
|
- if(APPLE AND NOT ENABLE_ARES)
|
|
|
- set(_use_core_foundation_and_core_services ON)
|
|
|
-
|
|
|
- find_library(SYSTEMCONFIGURATION_FRAMEWORK NAMES "SystemConfiguration")
|
|
|
- mark_as_advanced(SYSTEMCONFIGURATION_FRAMEWORK)
|
|
|
- if(NOT SYSTEMCONFIGURATION_FRAMEWORK)
|
|
|
- message(FATAL_ERROR "SystemConfiguration framework not found")
|
|
|
- endif()
|
|
|
- list(APPEND CURL_LIBS "-framework SystemConfiguration")
|
|
|
- endif()
|
|
|
-endif()
|
|
|
-if(ENABLE_IPV6)
|
|
|
- set(USE_IPV6 ON)
|
|
|
-endif()
|
|
|
-
|
|
|
if(0) # XXX(cmake): not needed for build within cmake
|
|
|
find_package(Perl)
|
|
|
|
|
|
@@ -740,7 +712,7 @@ endif() # XXX(cmake): end
|
|
|
|
|
|
# Disable warnings on Borland to avoid changing 3rd party code.
|
|
|
if(BORLAND)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " -w-")
|
|
|
endif()
|
|
|
|
|
|
# If we are on AIX, do the _ALL_SOURCE magic
|
|
|
@@ -766,15 +738,18 @@ include(CheckSymbolExists)
|
|
|
include(CheckTypeSize)
|
|
|
include(CheckCSourceCompiles)
|
|
|
|
|
|
-if(WIN32)
|
|
|
- # Preload settings on Windows
|
|
|
- include("${CMAKE_CURRENT_SOURCE_DIR}/CMake/win32-cache.cmake")
|
|
|
-elseif(APPLE)
|
|
|
- # Fast-track predictable feature detections
|
|
|
- set(HAVE_EVENTFD 0)
|
|
|
- set(HAVE_GETPASS_R 0)
|
|
|
- set(HAVE_SENDMMSG 0)
|
|
|
-elseif(AMIGA)
|
|
|
+option(_CURL_QUICK_DETECT "Fast-track known feature detection results (Windows, some Apple)" ON)
|
|
|
+if(_CURL_QUICK_DETECT)
|
|
|
+ if(WIN32)
|
|
|
+ include("${CMAKE_CURRENT_SOURCE_DIR}/CMake/win32-cache.cmake")
|
|
|
+ elseif(APPLE)
|
|
|
+ set(HAVE_EVENTFD 0)
|
|
|
+ set(HAVE_GETPASS_R 0)
|
|
|
+ set(HAVE_SENDMMSG 0)
|
|
|
+ endif()
|
|
|
+endif()
|
|
|
+
|
|
|
+if(AMIGA)
|
|
|
set(HAVE_GETADDRINFO 0) # Breaks the build when detected and used.
|
|
|
endif()
|
|
|
if(DOS OR AMIGA)
|
|
|
@@ -817,12 +792,40 @@ elseif(AMIGA)
|
|
|
elseif(NOT WIN32 AND NOT APPLE)
|
|
|
check_library_exists("socket" "connect" "" HAVE_LIBSOCKET)
|
|
|
if(HAVE_LIBSOCKET)
|
|
|
- set(CURL_LIBS "socket;${CURL_LIBS}")
|
|
|
+ set(CURL_LIBS "socket" ${CURL_LIBS})
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
|
-if(WIN32)
|
|
|
- list(APPEND CURL_LIBS "ws2_32" "bcrypt")
|
|
|
+option(ENABLE_IPV6 "Enable IPv6 support" ON)
|
|
|
+mark_as_advanced(ENABLE_IPV6)
|
|
|
+if(ENABLE_IPV6)
|
|
|
+ include(CheckStructHasMember)
|
|
|
+ if(WIN32)
|
|
|
+ check_struct_has_member("struct sockaddr_in6" "sin6_scope_id" "winsock2.h;ws2tcpip.h" HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID)
|
|
|
+ else()
|
|
|
+ check_struct_has_member("struct sockaddr_in6" "sin6_addr" "netinet/in.h" HAVE_SOCKADDR_IN6_SIN6_ADDR)
|
|
|
+ check_struct_has_member("struct sockaddr_in6" "sin6_scope_id" "netinet/in.h" HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID)
|
|
|
+ if(NOT HAVE_SOCKADDR_IN6_SIN6_ADDR)
|
|
|
+ if(NOT DOS AND NOT AMIGA)
|
|
|
+ message(WARNING "struct sockaddr_in6 not available, disabling IPv6 support")
|
|
|
+ endif()
|
|
|
+ set(ENABLE_IPV6 OFF CACHE BOOL "Enable IPv6 support" FORCE) # Force the feature off as we use this name as guard macro
|
|
|
+ endif()
|
|
|
+
|
|
|
+ if(APPLE AND NOT ENABLE_ARES)
|
|
|
+ set(_use_core_foundation_and_core_services ON)
|
|
|
+
|
|
|
+ find_library(SYSTEMCONFIGURATION_FRAMEWORK NAMES "SystemConfiguration")
|
|
|
+ mark_as_advanced(SYSTEMCONFIGURATION_FRAMEWORK)
|
|
|
+ if(NOT SYSTEMCONFIGURATION_FRAMEWORK)
|
|
|
+ message(FATAL_ERROR "SystemConfiguration framework not found")
|
|
|
+ endif()
|
|
|
+ list(APPEND CURL_LIBS "-framework SystemConfiguration")
|
|
|
+ endif()
|
|
|
+ endif()
|
|
|
+endif()
|
|
|
+if(ENABLE_IPV6)
|
|
|
+ set(USE_IPV6 ON)
|
|
|
endif()
|
|
|
|
|
|
if(0) # XXX(cmake): not needed for build within cmake
|
|
|
@@ -944,8 +947,9 @@ if(CURL_USE_OPENSSL)
|
|
|
set(_ssl_enabled ON)
|
|
|
set(USE_OPENSSL ON)
|
|
|
|
|
|
- list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})
|
|
|
- include_directories(${OPENSSL_INCLUDE_DIR})
|
|
|
+ # Depend on OpenSSL via imported targets. This allows our dependents to
|
|
|
+ # get our dependencies transitively.
|
|
|
+ list(APPEND CURL_LIBS OpenSSL::SSL OpenSSL::Crypto)
|
|
|
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "openssl")
|
|
|
|
|
|
if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "openssl")
|
|
|
@@ -954,7 +958,7 @@ if(CURL_USE_OPENSSL)
|
|
|
set(_curl_ca_bundle_supported TRUE)
|
|
|
|
|
|
cmake_push_check_state()
|
|
|
- list(APPEND CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
|
|
+ list(APPEND CMAKE_REQUIRED_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
|
|
|
if(NOT DEFINED HAVE_BORINGSSL)
|
|
|
check_symbol_exists("OPENSSL_IS_BORINGSSL" "openssl/base.h" HAVE_BORINGSSL)
|
|
|
endif()
|
|
|
@@ -1010,7 +1014,7 @@ if(CURL_USE_MBEDTLS)
|
|
|
include_directories(SYSTEM ${MBEDTLS_INCLUDE_DIRS})
|
|
|
link_directories(${MBEDTLS_LIBRARY_DIRS})
|
|
|
if(MBEDTLS_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MBEDTLS_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${MBEDTLS_CFLAGS}")
|
|
|
endif()
|
|
|
|
|
|
if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "mbedtls")
|
|
|
@@ -1046,7 +1050,7 @@ if(CURL_USE_WOLFSSL)
|
|
|
include_directories(SYSTEM ${WOLFSSL_INCLUDE_DIRS})
|
|
|
link_directories(${WOLFSSL_LIBRARY_DIRS})
|
|
|
if(WOLFSSL_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WOLFSSL_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${WOLFSSL_CFLAGS}")
|
|
|
endif()
|
|
|
|
|
|
if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "wolfssl")
|
|
|
@@ -1061,6 +1065,10 @@ if(CURL_USE_GNUTLS)
|
|
|
pkg_check_modules(GNUTLS "gnutls")
|
|
|
if(GNUTLS_FOUND)
|
|
|
set(GNUTLS_LIBRARIES ${GNUTLS_LINK_LIBRARIES})
|
|
|
+ string(REPLACE ";" " " GNUTLS_CFLAGS "${GNUTLS_CFLAGS}")
|
|
|
+ if(GNUTLS_CFLAGS)
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${GNUTLS_CFLAGS}")
|
|
|
+ endif()
|
|
|
endif()
|
|
|
endif()
|
|
|
if(NOT GNUTLS_FOUND)
|
|
|
@@ -1070,12 +1078,12 @@ if(CURL_USE_GNUTLS)
|
|
|
set(_ssl_enabled ON)
|
|
|
set(USE_GNUTLS ON)
|
|
|
list(APPEND CURL_LIBS ${GNUTLS_LIBRARIES} ${NETTLE_LIBRARIES})
|
|
|
- list(APPEND CURL_LIBDIRS ${NETTLE_LIBRARY_DIRS})
|
|
|
+ list(APPEND CURL_LIBDIRS ${GNUTLS_LIBRARY_DIRS} ${NETTLE_LIBRARY_DIRS})
|
|
|
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "gnutls" ${NETTLE_PC_REQUIRES})
|
|
|
include_directories(SYSTEM ${GNUTLS_INCLUDE_DIRS} ${NETTLE_INCLUDE_DIRS})
|
|
|
link_directories(${NETTLE_LIBRARY_DIRS})
|
|
|
if(NETTLE_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NETTLE_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${NETTLE_CFLAGS}")
|
|
|
endif()
|
|
|
|
|
|
if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "gnutls")
|
|
|
@@ -1102,7 +1110,7 @@ if(CURL_USE_RUSTLS)
|
|
|
include_directories(SYSTEM ${RUSTLS_INCLUDE_DIRS})
|
|
|
link_directories(${RUSTLS_LIBRARY_DIRS})
|
|
|
if(RUSTLS_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${RUSTLS_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${RUSTLS_CFLAGS}")
|
|
|
endif()
|
|
|
|
|
|
if(CURL_DEFAULT_SSL_BACKEND AND CURL_DEFAULT_SSL_BACKEND STREQUAL "rustls")
|
|
|
@@ -1142,7 +1150,7 @@ if(BROTLI_FOUND)
|
|
|
include_directories(SYSTEM ${BROTLI_INCLUDE_DIRS})
|
|
|
link_directories(${BROTLI_LIBRARY_DIRS})
|
|
|
if(BROTLI_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${BROTLI_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${BROTLI_CFLAGS}")
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
|
@@ -1157,7 +1165,7 @@ if(ZSTD_FOUND)
|
|
|
include_directories(SYSTEM ${ZSTD_INCLUDE_DIRS})
|
|
|
link_directories(${ZSTD_LIBRARY_DIRS})
|
|
|
if(ZSTD_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ZSTD_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${ZSTD_CFLAGS}")
|
|
|
endif()
|
|
|
else()
|
|
|
message(WARNING "zstd v1.0.0 or newer is required, disabling zstd support.")
|
|
|
@@ -1168,10 +1176,14 @@ endif()
|
|
|
macro(curl_openssl_check_symbol_exists _symbol _files _variable)
|
|
|
cmake_push_check_state()
|
|
|
if(USE_OPENSSL)
|
|
|
- list(APPEND CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
|
|
|
- list(APPEND CMAKE_REQUIRED_LIBRARIES "${OPENSSL_LIBRARIES}")
|
|
|
+ list(APPEND CMAKE_REQUIRED_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
|
|
|
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DOPENSSL_SUPPRESS_DEPRECATED") # for SSL_CTX_set_srp_username deprecated since 3.0.0
|
|
|
if(HAVE_LIBZ)
|
|
|
- list(APPEND CMAKE_REQUIRED_LIBRARIES "${ZLIB_LIBRARIES}")
|
|
|
+ if(CMAKE_USE_SYSTEM_ZLIB)
|
|
|
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ZLIB::ZLIB)
|
|
|
+ else()
|
|
|
+ list(APPEND CMAKE_REQUIRED_LIBRARIES cmzlib)
|
|
|
+ endif()
|
|
|
endif()
|
|
|
if(WIN32)
|
|
|
list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32")
|
|
|
@@ -1183,8 +1195,7 @@ macro(curl_openssl_check_symbol_exists _symbol _files _variable)
|
|
|
list(APPEND CMAKE_REQUIRED_LIBRARIES "${WOLFSSL_LIBRARIES}")
|
|
|
curl_required_libpaths("${WOLFSSL_LIBRARY_DIRS}")
|
|
|
if(HAVE_LIBZ)
|
|
|
- list(APPEND CMAKE_REQUIRED_INCLUDES "${ZLIB_INCLUDE_DIRS}") # Public wolfSSL headers require zlib headers
|
|
|
- list(APPEND CMAKE_REQUIRED_LIBRARIES "${ZLIB_LIBRARIES}")
|
|
|
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ZLIB::ZLIB) # Public wolfSSL headers also require zlib headers
|
|
|
endif()
|
|
|
if(WIN32)
|
|
|
list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32" "crypt32")
|
|
|
@@ -1276,7 +1287,7 @@ if(USE_NGHTTP2)
|
|
|
include_directories(SYSTEM ${NGHTTP2_INCLUDE_DIRS})
|
|
|
link_directories(${NGHTTP2_LIBRARY_DIRS})
|
|
|
if(NGHTTP2_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NGHTTP2_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${NGHTTP2_CFLAGS}")
|
|
|
endif()
|
|
|
else()
|
|
|
set(USE_NGHTTP2 OFF)
|
|
|
@@ -1308,7 +1319,7 @@ if(USE_NGTCP2)
|
|
|
include_directories(SYSTEM ${NGTCP2_INCLUDE_DIRS})
|
|
|
link_directories(${NGTCP2_LIBRARY_DIRS})
|
|
|
if(NGTCP2_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NGTCP2_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${NGTCP2_CFLAGS}")
|
|
|
endif()
|
|
|
|
|
|
find_package(NGHTTP3 REQUIRED)
|
|
|
@@ -1319,7 +1330,7 @@ if(USE_NGTCP2)
|
|
|
include_directories(SYSTEM ${NGHTTP3_INCLUDE_DIRS})
|
|
|
link_directories(${NGHTTP3_LIBRARY_DIRS})
|
|
|
if(NGHTTP3_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NGHTTP3_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${NGHTTP3_CFLAGS}")
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
|
@@ -1339,7 +1350,7 @@ if(USE_QUICHE)
|
|
|
include_directories(SYSTEM ${QUICHE_INCLUDE_DIRS})
|
|
|
link_directories(${QUICHE_LIBRARY_DIRS})
|
|
|
if(QUICHE_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${QUICHE_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${QUICHE_CFLAGS}")
|
|
|
endif()
|
|
|
if(NOT DEFINED HAVE_QUICHE_CONN_SET_QLOG_FD)
|
|
|
cmake_push_check_state()
|
|
|
@@ -1368,7 +1379,7 @@ if(USE_MSH3)
|
|
|
include_directories(SYSTEM ${MSH3_INCLUDE_DIRS})
|
|
|
link_directories(${MSH3_LIBRARY_DIRS})
|
|
|
if(MSH3_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MSH3_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${MSH3_CFLAGS}")
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
|
@@ -1409,20 +1420,20 @@ if(NOT CURL_DISABLE_LDAP)
|
|
|
# Check for LDAP
|
|
|
cmake_push_check_state()
|
|
|
if(USE_OPENSSL)
|
|
|
- list(APPEND CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
|
|
|
+ list(APPEND CMAKE_REQUIRED_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
|
|
|
endif()
|
|
|
find_package(LDAP)
|
|
|
if(LDAP_FOUND)
|
|
|
set(HAVE_LBER_H 1)
|
|
|
- set(CURL_LIBS "${LDAP_LIBRARIES};${CURL_LIBS}")
|
|
|
+ set(CURL_LIBS ${LDAP_LIBRARIES} ${CURL_LIBS})
|
|
|
list(APPEND CURL_LIBDIRS ${LDAP_LIBRARY_DIRS})
|
|
|
if(LDAP_PC_REQUIRES)
|
|
|
- set(LIBCURL_PC_REQUIRES_PRIVATE "${LDAP_PC_REQUIRES};${LIBCURL_PC_REQUIRES_PRIVATE}")
|
|
|
+ set(LIBCURL_PC_REQUIRES_PRIVATE ${LDAP_PC_REQUIRES} ${LIBCURL_PC_REQUIRES_PRIVATE})
|
|
|
endif()
|
|
|
include_directories(SYSTEM ${LDAP_INCLUDE_DIRS})
|
|
|
link_directories(${LDAP_LIBRARY_DIRS})
|
|
|
if(LDAP_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LDAP_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${LDAP_CFLAGS}")
|
|
|
endif()
|
|
|
|
|
|
# LDAP feature checks
|
|
|
@@ -1438,7 +1449,6 @@ if(NOT CURL_DISABLE_LDAP)
|
|
|
|
|
|
if(HAVE_LDAP_INIT_FD)
|
|
|
set(USE_OPENLDAP ON)
|
|
|
- add_definitions("-DLDAP_DEPRECATED=1")
|
|
|
endif()
|
|
|
if(NOT CURL_DISABLE_LDAPS)
|
|
|
set(HAVE_LDAP_SSL ON)
|
|
|
@@ -1492,13 +1502,13 @@ set(HAVE_LIBIDN2 OFF)
|
|
|
if(USE_LIBIDN2 AND NOT USE_APPLE_IDN AND NOT USE_WIN32_IDN)
|
|
|
find_package(Libidn2 QUIET)
|
|
|
if(LIBIDN2_FOUND)
|
|
|
- set(CURL_LIBS "${LIBIDN2_LIBRARIES};${CURL_LIBS}")
|
|
|
+ set(CURL_LIBS ${LIBIDN2_LIBRARIES} ${CURL_LIBS})
|
|
|
list(APPEND CURL_LIBDIRS ${LIBIDN2_LIBRARY_DIRS})
|
|
|
- set(LIBCURL_PC_REQUIRES_PRIVATE "${LIBIDN2_PC_REQUIRES};${LIBCURL_PC_REQUIRES_PRIVATE}")
|
|
|
+ set(LIBCURL_PC_REQUIRES_PRIVATE ${LIBIDN2_PC_REQUIRES} ${LIBCURL_PC_REQUIRES_PRIVATE})
|
|
|
include_directories(SYSTEM ${LIBIDN2_INCLUDE_DIRS})
|
|
|
link_directories(${LIBIDN2_LIBRARY_DIRS})
|
|
|
if(LIBIDN2_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBIDN2_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${LIBIDN2_CFLAGS}")
|
|
|
endif()
|
|
|
set(HAVE_IDN2_H 1)
|
|
|
set(HAVE_LIBIDN2 1)
|
|
|
@@ -1518,7 +1528,7 @@ if(CURL_USE_LIBPSL)
|
|
|
include_directories(SYSTEM ${LIBPSL_INCLUDE_DIRS})
|
|
|
link_directories(${LIBPSL_LIBRARY_DIRS})
|
|
|
if(LIBPSL_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBPSL_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${LIBPSL_CFLAGS}")
|
|
|
endif()
|
|
|
set(USE_LIBPSL ON)
|
|
|
endif()
|
|
|
@@ -1531,13 +1541,13 @@ set(USE_LIBSSH2 OFF)
|
|
|
if(CURL_USE_LIBSSH2)
|
|
|
find_package(Libssh2)
|
|
|
if(LIBSSH2_FOUND)
|
|
|
- list(APPEND CURL_LIBS ${LIBSSH2_LIBRARIES})
|
|
|
+ set(CURL_LIBS ${LIBSSH2_LIBRARIES} ${CURL_LIBS}) # keep it before TLS-crypto, compression
|
|
|
list(APPEND CURL_LIBDIRS ${LIBSSH2_LIBRARY_DIRS})
|
|
|
- list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${LIBSSH2_PC_REQUIRES})
|
|
|
+ set(LIBCURL_PC_REQUIRES_PRIVATE ${LIBSSH2_PC_REQUIRES} ${LIBCURL_PC_REQUIRES_PRIVATE})
|
|
|
include_directories(SYSTEM ${LIBSSH2_INCLUDE_DIRS})
|
|
|
link_directories(${LIBSSH2_LIBRARY_DIRS})
|
|
|
if(LIBSSH2_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBSSH2_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${LIBSSH2_CFLAGS}")
|
|
|
endif()
|
|
|
set(USE_LIBSSH2 ON)
|
|
|
endif()
|
|
|
@@ -1548,13 +1558,13 @@ option(CURL_USE_LIBSSH "Use libssh" OFF)
|
|
|
mark_as_advanced(CURL_USE_LIBSSH)
|
|
|
if(NOT USE_LIBSSH2 AND CURL_USE_LIBSSH)
|
|
|
find_package(Libssh REQUIRED)
|
|
|
- list(APPEND CURL_LIBS ${LIBSSH_LIBRARIES})
|
|
|
+ set(CURL_LIBS ${LIBSSH_LIBRARIES} ${CURL_LIBS}) # keep it before TLS-crypto, compression
|
|
|
list(APPEND CURL_LIBDIRS ${LIBSSH_LIBRARY_DIRS})
|
|
|
- list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${LIBSSH_PC_REQUIRES})
|
|
|
+ set(LIBCURL_PC_REQUIRES_PRIVATE ${LIBSSH_PC_REQUIRES} ${LIBCURL_PC_REQUIRES_PRIVATE})
|
|
|
include_directories(SYSTEM ${LIBSSH_INCLUDE_DIRS})
|
|
|
link_directories(${LIBSSH_LIBRARY_DIRS})
|
|
|
if(LIBSSH_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBSSH_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${LIBSSH_CFLAGS}")
|
|
|
endif()
|
|
|
set(USE_LIBSSH ON)
|
|
|
endif()
|
|
|
@@ -1567,7 +1577,7 @@ if(NOT USE_LIBSSH2 AND NOT USE_LIBSSH AND CURL_USE_WOLFSSH)
|
|
|
if(USE_WOLFSSL)
|
|
|
find_package(WolfSSH)
|
|
|
if(WOLFSSH_FOUND)
|
|
|
- list(APPEND CURL_LIBS ${WOLFSSH_LIBRARIES})
|
|
|
+ set(CURL_LIBS ${WOLFSSH_LIBRARIES} ${CURL_LIBS}) # keep it before TLS-crypto, compression
|
|
|
include_directories(SYSTEM ${WOLFSSH_INCLUDE_DIRS})
|
|
|
set(USE_WOLFSSH ON)
|
|
|
endif()
|
|
|
@@ -1586,7 +1596,7 @@ if(CURL_USE_GSASL)
|
|
|
include_directories(SYSTEM ${LIBGSASL_INCLUDE_DIRS})
|
|
|
link_directories(${LIBGSASL_LIBRARY_DIRS})
|
|
|
if(LIBGSASL_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBGSASL_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${LIBGSASL_CFLAGS}")
|
|
|
endif()
|
|
|
set(USE_GSASL ON)
|
|
|
endif()
|
|
|
@@ -1605,7 +1615,7 @@ if(CURL_USE_GSSAPI)
|
|
|
include_directories(SYSTEM ${GSS_INCLUDE_DIRS})
|
|
|
link_directories(${GSS_LIBRARY_DIRS})
|
|
|
if(GSS_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GSS_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${GSS_CFLAGS}")
|
|
|
endif()
|
|
|
|
|
|
if(GSS_FLAVOUR STREQUAL "GNU")
|
|
|
@@ -1631,7 +1641,7 @@ if(CURL_USE_GSSAPI)
|
|
|
endif()
|
|
|
|
|
|
if(NOT DEFINED HAVE_GSS_C_NT_HOSTBASED_SERVICE)
|
|
|
- set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${GSS_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_REQUIRED_FLAGS " ${GSS_CFLAGS}")
|
|
|
list(APPEND CMAKE_REQUIRED_LIBRARIES ${GSS_LIBRARIES})
|
|
|
curl_required_libpaths("${GSS_LIBRARY_DIRS}")
|
|
|
check_symbol_exists("GSS_C_NT_HOSTBASED_SERVICE" "${_include_list}" HAVE_GSS_C_NT_HOSTBASED_SERVICE)
|
|
|
@@ -1661,7 +1671,7 @@ if(CURL_USE_LIBUV)
|
|
|
include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
|
|
|
link_directories(${LIBUV_LIBRARY_DIRS})
|
|
|
if(LIBUV_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUV_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${LIBUV_CFLAGS}")
|
|
|
endif()
|
|
|
set(USE_LIBUV ON)
|
|
|
set(HAVE_UV_H ON)
|
|
|
@@ -1676,7 +1686,7 @@ if(USE_LIBRTMP)
|
|
|
include_directories(SYSTEM ${LIBRTMP_INCLUDE_DIRS})
|
|
|
link_directories(${LIBRTMP_LIBRARY_DIRS})
|
|
|
if(LIBRTMP_CFLAGS)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBRTMP_CFLAGS}")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " ${LIBRTMP_CFLAGS}")
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
|
@@ -1875,7 +1885,7 @@ foreach(_variable IN ITEMS
|
|
|
HAVE_UNISTD_H
|
|
|
)
|
|
|
if(${_variable})
|
|
|
- set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D${_variable}")
|
|
|
+ string(APPEND CURL_TEST_DEFINES " -D${_variable}")
|
|
|
endif()
|
|
|
endforeach()
|
|
|
|
|
|
@@ -1946,14 +1956,15 @@ check_function_exists("eventfd" HAVE_EVENTFD)
|
|
|
check_symbol_exists("ftruncate" "unistd.h" HAVE_FTRUNCATE)
|
|
|
check_symbol_exists("getpeername" "${CURL_INCLUDES}" HAVE_GETPEERNAME) # winsock2.h unistd.h proto/bsdsocket.h
|
|
|
check_symbol_exists("getsockname" "${CURL_INCLUDES}" HAVE_GETSOCKNAME) # winsock2.h unistd.h proto/bsdsocket.h
|
|
|
-check_function_exists("if_nametoindex" HAVE_IF_NAMETOINDEX) # winsock2.h net/if.h
|
|
|
check_function_exists("getrlimit" HAVE_GETRLIMIT)
|
|
|
check_function_exists("setlocale" HAVE_SETLOCALE)
|
|
|
check_function_exists("setmode" HAVE_SETMODE)
|
|
|
check_function_exists("setrlimit" HAVE_SETRLIMIT)
|
|
|
|
|
|
if(NOT WIN32)
|
|
|
- check_function_exists("sched_yield" HAVE_SCHED_YIELD)
|
|
|
+ check_function_exists("if_nametoindex" HAVE_IF_NAMETOINDEX) # iphlpapi.h (Windows non-UWP), net/if.h
|
|
|
+ check_function_exists("realpath" HAVE_REALPATH)
|
|
|
+ check_function_exists("sched_yield" HAVE_SCHED_YIELD)
|
|
|
check_symbol_exists("strcasecmp" "string.h" HAVE_STRCASECMP)
|
|
|
check_symbol_exists("stricmp" "string.h" HAVE_STRICMP)
|
|
|
check_symbol_exists("strcmpi" "string.h" HAVE_STRCMPI)
|
|
|
@@ -1971,15 +1982,16 @@ if(NOT _ssl_enabled)
|
|
|
check_symbol_exists("arc4random" "${CURL_INCLUDES};stdlib.h" HAVE_ARC4RANDOM)
|
|
|
endif()
|
|
|
|
|
|
-if(NOT MSVC OR (MSVC_VERSION GREATER_EQUAL 1900))
|
|
|
- # Earlier MSVC compilers had faulty snprintf implementations
|
|
|
- check_function_exists("snprintf" HAVE_SNPRINTF)
|
|
|
+if(NOT MSVC)
|
|
|
+ check_function_exists("snprintf" HAVE_SNPRINTF) # to match detection method in ./configure
|
|
|
+elseif(MSVC_VERSION GREATER_EQUAL 1900) # Earlier MSVC compilers had faulty snprintf implementations
|
|
|
+ check_symbol_exists("snprintf" "stdio.h" HAVE_SNPRINTF) # snprintf may be a compatibility macro, not an exported function
|
|
|
endif()
|
|
|
if(APPLE)
|
|
|
check_function_exists("mach_absolute_time" HAVE_MACH_ABSOLUTE_TIME)
|
|
|
endif()
|
|
|
-check_symbol_exists("inet_ntop" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_NTOP) # arpa/inet.h
|
|
|
-check_symbol_exists("inet_pton" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_PTON) # arpa/inet.h
|
|
|
+check_symbol_exists("inet_ntop" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_NTOP) # arpa/inet.h netinet/in.h sys/socket.h
|
|
|
+check_symbol_exists("inet_pton" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_PTON) # arpa/inet.h netinet/in.h sys/socket.h
|
|
|
|
|
|
check_symbol_exists("fsetxattr" "sys/xattr.h" HAVE_FSETXATTR)
|
|
|
if(HAVE_FSETXATTR)
|
|
|
@@ -2124,7 +2136,7 @@ if(CMAKE_COMPILER_IS_GNUCC AND APPLE)
|
|
|
# The Mac version of GCC warns about use of long double. Disable it.
|
|
|
get_source_file_property(_mprintf_compile_flags "mprintf.c" COMPILE_FLAGS)
|
|
|
if(_mprintf_compile_flags)
|
|
|
- set(_mprintf_compile_flags "${_mprintf_compile_flags} -Wno-long-double")
|
|
|
+ string(APPEND _mprintf_compile_flags " -Wno-long-double")
|
|
|
else()
|
|
|
set(_mprintf_compile_flags "-Wno-long-double")
|
|
|
endif()
|
|
|
@@ -2143,13 +2155,15 @@ include(CMake/OtherTests.cmake)
|
|
|
add_definitions("-DHAVE_CONFIG_H")
|
|
|
|
|
|
if(WIN32)
|
|
|
+ list(APPEND CURL_LIBS "ws2_32" "bcrypt")
|
|
|
+
|
|
|
# _fseeki64() requires VS2005
|
|
|
if(NOT MSVC OR (MSVC_VERSION GREATER_EQUAL 1400))
|
|
|
set(USE_WIN32_LARGE_FILES ON)
|
|
|
endif()
|
|
|
|
|
|
# Use the manifest embedded in the Windows Resource
|
|
|
- set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -DCURL_EMBED_MANIFEST")
|
|
|
+ string(APPEND CMAKE_RC_FLAGS " -DCURL_EMBED_MANIFEST")
|
|
|
|
|
|
# We use crypto functions that are not available for UWP apps
|
|
|
if(NOT WINDOWS_STORE)
|
|
|
@@ -2164,26 +2178,25 @@ endif()
|
|
|
|
|
|
if(MSVC)
|
|
|
# Disable default manifest added by CMake
|
|
|
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -MANIFEST:NO")
|
|
|
+ string(APPEND CMAKE_EXE_LINKER_FLAGS " -MANIFEST:NO")
|
|
|
|
|
|
if(CMAKE_C_FLAGS MATCHES "[/-]W[0-4]")
|
|
|
string(REGEX REPLACE "[/-]W[0-4]" "-W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
|
|
else()
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W4")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " -W4")
|
|
|
endif()
|
|
|
|
|
|
# Use multithreaded compilation on VS2008+
|
|
|
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND MSVC_VERSION GREATER_EQUAL 1500)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MP")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " -MP")
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
|
if(CURL_WERROR)
|
|
|
if(MSVC)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -WX")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " -WX")
|
|
|
else()
|
|
|
- # This assumes clang or gcc style options
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
|
|
|
+ string(APPEND CMAKE_C_FLAGS " -Werror") # This assumes clang or gcc style options
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
|
@@ -2352,7 +2365,7 @@ curl_add_if("brotli" HAVE_BROTLI)
|
|
|
curl_add_if("gsasl" USE_GSASL)
|
|
|
curl_add_if("zstd" HAVE_ZSTD)
|
|
|
curl_add_if("AsynchDNS" USE_ARES OR USE_THREADS_POSIX OR USE_THREADS_WIN32)
|
|
|
-curl_add_if("asyn-rr" USE_ARES AND ENABLE_THREADED_RESOLVER)
|
|
|
+curl_add_if("asyn-rr" USE_ARES AND ENABLE_THREADED_RESOLVER AND USE_HTTPSRR)
|
|
|
curl_add_if("IDN" (HAVE_LIBIDN2 AND HAVE_IDN2_H) OR
|
|
|
USE_WIN32_IDN OR
|
|
|
USE_APPLE_IDN)
|
|
|
@@ -2427,7 +2440,6 @@ if(NOT CURL_DISABLE_INSTALL)
|
|
|
|
|
|
# curl-config needs the following options to be set.
|
|
|
set(CC "${CMAKE_C_COMPILER}")
|
|
|
- # TODO: probably put a -D... options here?
|
|
|
set(CONFIGURE_OPTIONS "")
|
|
|
set(CURLVERSION "${_curl_version}")
|
|
|
set(VERSIONNUM "${_curl_version_num}")
|
|
|
@@ -2471,18 +2483,18 @@ if(NOT CURL_DISABLE_INSTALL)
|
|
|
endforeach()
|
|
|
|
|
|
# Avoid getting unnecessary -L options for known system directories.
|
|
|
- set(_sys_libdirs "")
|
|
|
+ set(_sys_libdirs "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
|
|
|
foreach(_libdir IN LISTS CMAKE_SYSTEM_PREFIX_PATH)
|
|
|
if(_libdir MATCHES "/$")
|
|
|
- set(_libdir "${_libdir}lib")
|
|
|
+ string(APPEND _libdir "lib")
|
|
|
else()
|
|
|
- set(_libdir "${_libdir}/lib")
|
|
|
+ string(APPEND _libdir "/lib")
|
|
|
endif()
|
|
|
if(IS_DIRECTORY "${_libdir}")
|
|
|
list(APPEND _sys_libdirs "${_libdir}")
|
|
|
endif()
|
|
|
if(DEFINED CMAKE_LIBRARY_ARCHITECTURE)
|
|
|
- set(_libdir "${_libdir}/${CMAKE_LIBRARY_ARCHITECTURE}")
|
|
|
+ string(APPEND _libdir "/${CMAKE_LIBRARY_ARCHITECTURE}")
|
|
|
if(IS_DIRECTORY "${_libdir}")
|
|
|
list(APPEND _sys_libdirs "${_libdir}")
|
|
|
endif()
|
|
|
@@ -2490,6 +2502,9 @@ if(NOT CURL_DISABLE_INSTALL)
|
|
|
endforeach()
|
|
|
|
|
|
foreach(_libdir IN LISTS _custom_libdirs CURL_LIBDIRS)
|
|
|
+ if(NOT CMAKE_VERSION VERSION_LESS 3.20)
|
|
|
+ cmake_path(SET _libdir NORMALIZE "${_libdir}")
|
|
|
+ endif()
|
|
|
list(FIND _sys_libdirs "${_libdir}" _libdir_index)
|
|
|
if(_libdir_index LESS 0)
|
|
|
list(APPEND _ldflags "-L${_libdir}")
|
|
|
@@ -2498,7 +2513,7 @@ if(NOT CURL_DISABLE_INSTALL)
|
|
|
|
|
|
set(_implicit_libs "")
|
|
|
if(NOT MINGW AND NOT UNIX)
|
|
|
- set(_implicit_libs ${CMAKE_C_IMPLICIT_LINK_LIBRARIES})
|
|
|
+ set(_implicit_libs "${CMAKE_C_IMPLICIT_LINK_LIBRARIES}")
|
|
|
endif()
|
|
|
|
|
|
foreach(_lib IN LISTS _implicit_libs _custom_libs CURL_LIBS)
|
|
|
@@ -2524,6 +2539,9 @@ if(NOT CURL_DISABLE_INSTALL)
|
|
|
get_filename_component(_libdir ${_lib} DIRECTORY)
|
|
|
get_filename_component(_libname ${_lib} NAME_WE)
|
|
|
if(_libname MATCHES "^lib")
|
|
|
+ if(NOT CMAKE_VERSION VERSION_LESS 3.20)
|
|
|
+ cmake_path(SET _libdir NORMALIZE "${_libdir}")
|
|
|
+ endif()
|
|
|
list(FIND _sys_libdirs "${_libdir}" _libdir_index)
|
|
|
if(_libdir_index LESS 0)
|
|
|
list(APPEND _ldflags "-L${_libdir}")
|
|
|
@@ -2694,6 +2712,7 @@ if(NOT CURL_DISABLE_INSTALL)
|
|
|
endif()
|
|
|
|
|
|
# Save build info for test runner to pick up and log
|
|
|
+set(_cmake_sysroot "")
|
|
|
if(CMAKE_OSX_SYSROOT)
|
|
|
set(_cmake_sysroot ${CMAKE_OSX_SYSROOT})
|
|
|
elseif(CMAKE_SYSROOT)
|