mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-30 20:59:12 +08:00
829c9e3def
Refactor curl port: - Add test - Refine dependencies patch - gssapi feature is not for windows <!-- If your PR fixes issues, please note that here by adding "Fixes #NNNNNN." for each fixed issue on separate lines. --> <!-- If you are still working on the PR, open it as a Draft: https://github.blog/2019-02-14-introducing-draft-pull-requests/. --> - [x] Changes comply with the [maintainer guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md). - [x] SHA512s are updated for each updated download. - [x] The "supports" clause reflects platforms that may be fixed by this new version. - [x] Any fixed [CI baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt) entries are removed from that file. - [x] Any patches that are no longer applied are deleted from the port's directory. - [x] The version database is fixed by rerunning `./vcpkg x-add-version --all` and committing the result. - [x] Only one version is added to each modified port's versions file. <!-- If this PR adds a new port, please uncomment and fill out this checklist: - [ ] Changes comply with the [maintainer guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md). - [ ] The name of the port matches an existing name for this component on https://repology.org/ if possible, and/or is strongly associated with that component on search engines. - [ ] Optional dependencies are resolved in exactly one way. For example, if the component is built with CMake, all `find_package` calls are REQUIRED, are satisfied by `vcpkg.json`'s declared dependencies, or disabled with [CMAKE_DISABLE_FIND_PACKAGE_Xxx](https://cmake.org/cmake/help/latest/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.html). - [ ] The versioning scheme in `vcpkg.json` matches what upstream says. - [ ] The license declaration in `vcpkg.json` matches what upstream says. - [ ] The installed as the "copyright" file matches what upstream says. - [ ] The source code of the component installed comes from an authoritative source. - [ ] The generated "usage text" is accurate. See [adding-usage](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/examples/adding-usage.md) for context. - [ ] The version database is fixed by rerunning `./vcpkg x-add-version --all` and committing the result. - [ ] Only one version is in the new port's versions file. - [ ] Only one version is added to each modified port's versions file. END OF NEW PORT CHECKLIST (delete this line) --> Co-authored-by: WangWeiLin-MV <156736127+WangWeiLin-MV@users.noreply.github.com>
92 lines
3.1 KiB
Diff
92 lines
3.1 KiB
Diff
diff --git a/CMake/curl-config.cmake.in b/CMake/curl-config.cmake.in
|
|
index 9adb96e0a..a013adf7a 100644
|
|
--- a/CMake/curl-config.cmake.in
|
|
+++ b/CMake/curl-config.cmake.in
|
|
@@ -31,6 +31,16 @@ 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()
|
|
+
|
|
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
|
|
check_required_components("@PROJECT_NAME@")
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 656aa7c74..90a7c1371 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -163,7 +163,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()
|
|
|
|
@@ -575,7 +576,9 @@ 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.
|
|
@@ -876,11 +879,10 @@ 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}")
|
|
+ list(APPEND CURL_LIBS ${LIBPSL_LINK_LIBRARIES})
|
|
set(USE_LIBPSL ON)
|
|
endif()
|
|
endif()
|
|
@@ -891,7 +893,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}")
|
|
@@ -917,6 +925,14 @@ option(CURL_USE_GSSAPI "Use GSSAPI implementation (right now only Heimdal is sup
|
|
mark_as_advanced(CURL_USE_GSSAPI)
|
|
|
|
if(CURL_USE_GSSAPI)
|
|
+ find_package(PkgConfig REQUIRED)
|
|
+ pkg_check_modules(KRB5 REQUIRED krb5 krb5-gssapi)
|
|
+ list(APPEND CURL_LIBS ${KRB5_LINK_LIBRARIES} resolv)
|
|
+ check_include_file_concat("gssapi/gssapi.h" HAVE_GSSAPI_GSSAPI_H)
|
|
+ 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)
|
|
+ set(HAVE_GSSAPI ON)
|
|
+ elseif(0)
|
|
find_package(GSS)
|
|
|
|
set(HAVE_GSSAPI ${GSS_FOUND})
|