mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-17 07:47:51 +08:00
2318038614
Merged upstream as https://github.com/curl/curl/pull/13948
182 lines
6.3 KiB
Diff
182 lines
6.3 KiB
Diff
diff --git a/CMake/curl-config.cmake.in b/CMake/curl-config.cmake.in
|
|
index 9adb96e0a..9bf69004d 100644
|
|
--- a/CMake/curl-config.cmake.in
|
|
+++ b/CMake/curl-config.cmake.in
|
|
@@ -31,6 +31,19 @@ if(@USE_ZLIB@)
|
|
find_dependency(ZLIB @ZLIB_VERSION_MAJOR@)
|
|
endif()
|
|
|
|
+if("@USE_ARES@")
|
|
+ find_dependency(c-ares CONFIG)
|
|
+endif()
|
|
+if("@USE_LIBSSH2@")
|
|
+ find_dependency(Libssh2 CONFIG)
|
|
+endif()
|
|
+if("@HAVE_BROTLI@")
|
|
+ find_dependency(unofficial-brotli CONFIG)
|
|
+endif()
|
|
+if("@HAVE_ZSTD@")
|
|
+ find_dependency(zstd CONFIG)
|
|
+endif()
|
|
+
|
|
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
|
|
check_required_components("@PROJECT_NAME@")
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index c3525d3fc..1927464e8 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -164,7 +164,8 @@ set(CURL_LIBS "")
|
|
|
|
if(ENABLE_ARES)
|
|
set(USE_ARES 1)
|
|
- find_package(CARES REQUIRED)
|
|
+ find_package(CARES NAMES c-ares CONFIG REQUIRED)
|
|
+ set(CARES_LIBRARY c-ares::cares)
|
|
list(APPEND CURL_LIBS ${CARES_LIBRARY})
|
|
endif()
|
|
|
|
@@ -461,7 +462,7 @@ if(use_core_foundation_and_core_services)
|
|
message(FATAL_ERROR "CoreServices framework not found")
|
|
endif()
|
|
|
|
- list(APPEND CURL_LIBS "-framework CoreFoundation -framework CoreServices")
|
|
+ list(APPEND CURL_LIBS "-framework CoreFoundation" "-framework CoreServices")
|
|
endif()
|
|
|
|
if(CURL_USE_OPENSSL)
|
|
@@ -577,10 +578,11 @@ endif()
|
|
option(CURL_BROTLI "Set to ON to enable building curl with brotli support." OFF)
|
|
set(HAVE_BROTLI OFF)
|
|
if(CURL_BROTLI)
|
|
- find_package(Brotli REQUIRED)
|
|
+ find_package(BROTLI NAMES unofficial-brotli REQUIRED)
|
|
+ set(BROTLI_INCLUDE_DIRS "")
|
|
+ set(BROTLI_LIBRARIES "unofficial::brotli::brotlidec")
|
|
if(BROTLI_FOUND)
|
|
set(HAVE_BROTLI ON)
|
|
- set(CURL_LIBS "${BROTLI_LIBRARIES};${CURL_LIBS}") # For 'ld' linker. Emulate `list(PREPEND ...)` to stay compatible with <v3.15 CMake.
|
|
list(APPEND CURL_LIBS ${BROTLI_LIBRARIES})
|
|
include_directories(${BROTLI_INCLUDE_DIRS})
|
|
list(APPEND CMAKE_REQUIRED_INCLUDES ${BROTLI_INCLUDE_DIRS})
|
|
@@ -590,7 +592,9 @@ endif()
|
|
option(CURL_ZSTD "Set to ON to enable building curl with zstd support." OFF)
|
|
set(HAVE_ZSTD OFF)
|
|
if(CURL_ZSTD)
|
|
- find_package(Zstd REQUIRED)
|
|
+ find_package(Zstd NAMES zstd REQUIRED)
|
|
+ set(Zstd_INCLUDE_DIRS "")
|
|
+ set(Zstd_LIBRARIES zstd::libzstd)
|
|
if(Zstd_FOUND AND NOT Zstd_VERSION VERSION_LESS "1.0.0")
|
|
set(HAVE_ZSTD ON)
|
|
list(APPEND CURL_LIBS ${Zstd_LIBRARIES})
|
|
@@ -883,8 +887,13 @@ endif()
|
|
# Check for idn2
|
|
option(USE_LIBIDN2 "Use libidn2 for IDN support" ON)
|
|
if(USE_LIBIDN2)
|
|
- check_library_exists("idn2" "idn2_lookup_ul" "" HAVE_LIBIDN2)
|
|
+ find_package(PkgConfig REQUIRED)
|
|
+ pkg_check_modules(LIBIDN2 REQUIRED libidn2)
|
|
+ set(HAVE_LIBIDN2 TRUE)
|
|
if(HAVE_LIBIDN2)
|
|
+ list(APPEND CURL_LIBS ${LIBIDN2_LINK_LIBRARIES})
|
|
+ set(HAVE_IDN2_H TRUE)
|
|
+ elseif(0)
|
|
set(CURL_LIBS "idn2;${CURL_LIBS}")
|
|
check_include_file_concat("idn2.h" HAVE_IDN2_H)
|
|
endif()
|
|
@@ -920,11 +929,18 @@ mark_as_advanced(CURL_USE_LIBPSL)
|
|
set(USE_LIBPSL OFF)
|
|
|
|
if(CURL_USE_LIBPSL)
|
|
- find_package(LibPSL)
|
|
+ find_package(PkgConfig REQUIRED)
|
|
+ pkg_check_modules(LIBPSL REQUIRED libpsl)
|
|
if(LIBPSL_FOUND)
|
|
- list(APPEND CURL_LIBS ${LIBPSL_LIBRARY})
|
|
- list(APPEND CMAKE_REQUIRED_INCLUDES "${LIBPSL_INCLUDE_DIR}")
|
|
- include_directories("${LIBPSL_INCLUDE_DIR}")
|
|
+ # Remove standard win32 libs pulled in transitively from icu
|
|
+ string(REPLACE " " "|" win32_standard_libraries "/(${CMAKE_C_STANDARD_LIBRARIES})[.]lib\$")
|
|
+ foreach(lib IN LISTS LIBPSL_LINK_LIBRARIES)
|
|
+ string(TOLOWER "${lib}" lib_lower)
|
|
+ if(lib_lower MATCHES win32_standard_libraries)
|
|
+ list(REMOVE_ITEM LIBPSL_LINK_LIBRARIES "${lib}")
|
|
+ endif()
|
|
+ endforeach()
|
|
+ list(APPEND CURL_LIBS ${LIBPSL_LINK_LIBRARIES})
|
|
set(USE_LIBPSL ON)
|
|
endif()
|
|
endif()
|
|
@@ -935,7 +951,13 @@ mark_as_advanced(CURL_USE_LIBSSH2)
|
|
set(USE_LIBSSH2 OFF)
|
|
|
|
if(CURL_USE_LIBSSH2)
|
|
- find_package(LibSSH2)
|
|
+ find_package(LIBSSH2 NAMES Libssh2 REQUIRED)
|
|
+ if(TARGET Libssh2::libssh2_shared)
|
|
+ set(LIBSSH2_LIBRARY Libssh2::libssh2_shared)
|
|
+ else()
|
|
+ set(LIBSSH2_LIBRARY Libssh2::libssh2_static)
|
|
+ endif()
|
|
+ get_target_property(LIBSSH2_INCLUDE_DIR "${LIBSSH2_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES)
|
|
if(LIBSSH2_FOUND)
|
|
list(APPEND CURL_LIBS ${LIBSSH2_LIBRARY})
|
|
list(APPEND CMAKE_REQUIRED_INCLUDES "${LIBSSH2_INCLUDE_DIR}")
|
|
@@ -957,11 +979,24 @@ if(NOT USE_LIBSSH2 AND CURL_USE_LIBSSH)
|
|
endif()
|
|
endif()
|
|
|
|
+option(CURL_USE_GSASL "Use GSASL implementation" OFF)
|
|
+mark_as_advanced(CURL_USE_GSASL)
|
|
+if(CURL_USE_GSASL)
|
|
+ find_package(PkgConfig REQUIRED)
|
|
+ pkg_check_modules(GSASL REQUIRED libgsasl)
|
|
+ list(APPEND CURL_LIBS ${GSASL_LINK_LIBRARIES})
|
|
+ set(USE_GSASL ON)
|
|
+endif()
|
|
+
|
|
option(CURL_USE_GSSAPI "Use GSSAPI implementation (right now only Heimdal is supported with CMake build)" OFF)
|
|
mark_as_advanced(CURL_USE_GSSAPI)
|
|
|
|
if(CURL_USE_GSSAPI)
|
|
- find_package(GSS)
|
|
+ find_package(PkgConfig REQUIRED)
|
|
+ pkg_check_modules(GSS REQUIRED krb5-gssapi)
|
|
+ list(APPEND CURL_LIBS ${GSS_LINK_LIBRARIES})
|
|
+ list(APPEND CURL_LIBS resolv) # Fixme: move to krb5 pc files
|
|
+ pkg_get_variable(GSS_FLAVOUR krb5-gssapi vendor)
|
|
|
|
set(HAVE_GSSAPI ${GSS_FOUND})
|
|
if(GSS_FOUND)
|
|
@@ -973,6 +1008,7 @@ if(CURL_USE_GSSAPI)
|
|
check_include_file_concat("gssapi/gssapi_generic.h" HAVE_GSSAPI_GSSAPI_GENERIC_H)
|
|
check_include_file_concat("gssapi/gssapi_krb5.h" HAVE_GSSAPI_GSSAPI_KRB5_H)
|
|
|
|
+ elseif(0)
|
|
if(NOT GSS_FLAVOUR STREQUAL "Heimdal")
|
|
# MIT
|
|
set(_INCLUDE_LIST "")
|
|
@@ -1618,6 +1654,7 @@ if(NOT CURL_DISABLE_INSTALL)
|
|
_add_if("UnixSockets" USE_UNIX_SOCKETS)
|
|
_add_if("libz" HAVE_LIBZ)
|
|
_add_if("brotli" HAVE_BROTLI)
|
|
+ _add_if("gsasl" USE_GSASL)
|
|
_add_if("zstd" HAVE_ZSTD)
|
|
_add_if("AsynchDNS" USE_ARES OR USE_THREADS_POSIX OR USE_THREADS_WIN32)
|
|
_add_if("IDN" HAVE_LIBIDN2 OR USE_WIN32_IDN OR USE_APPLE_IDN)
|
|
diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake
|
|
index 3a46c6490..7ce3facb6 100644
|
|
--- a/lib/curl_config.h.cmake
|
|
+++ b/lib/curl_config.h.cmake
|
|
@@ -713,6 +713,9 @@ ${SIZEOF_TIME_T_CODE}
|
|
/* if librtmp/rtmpdump is in use */
|
|
#cmakedefine USE_LIBRTMP 1
|
|
|
|
+/* if GSASL is in use */
|
|
+#cmakedefine USE_GSASL 1
|
|
+
|
|
/* Define to 1 if you don't want the OpenSSL configuration to be loaded
|
|
automatically */
|
|
#cmakedefine CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG 1
|