vcpkg/ports/aws-sdk-cpp/fix_find_curl.patch
jim wang 43de6acd6f
[aws-sdk-cpp] Fix failure to call curl[c-ares] (#38215)
Fixes https://github.com/microsoft/vcpkg/issues/36661
Fix calling curl using config mode.
- [X] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [ ] ~~SHA512s are updated for each updated download.~~
- [ ] ~~The "supports" clause reflects platforms that may be fixed by
this new version.~~
- [ ] ~~Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.~~
- [ ] ~~Any patches that are no longer applied are deleted from the
port's directory.~~
- [ ] ~~The version database is fixed by rerunning `./vcpkg
x-add-version --all` and committing the result.~~
- [ ] ~~Only one version is added to each modified port's versions
file.~~

Compile test pass with following triplets:
```
x64-windows
arm64-osx
```
2024-04-18 19:50:19 -04:00

32 lines
1.5 KiB
Diff

diff --git a/cmake/external_dependencies.cmake b/cmake/external_dependencies.cmake
index acf16c0..3a49fb4 100644
--- a/cmake/external_dependencies.cmake
+++ b/cmake/external_dependencies.cmake
@@ -80,23 +80,12 @@ if(NOT NO_HTTP_CLIENT AND NOT USE_CRT_HTTP_CLIENT)
set(BUILD_CURL 1)
message(STATUS " Building Curl as part of AWS SDK")
else()
- include(FindCURL)
+ find_package(CURL REQUIRED)
if(NOT CURL_FOUND)
message(FATAL_ERROR "Could not find curl")
+ else()
+ set(CURL_LIBRARIES CURL::libcurl)
endif()
-
- # When built from source using cmake, curl does not include
- # CURL_INCLUDE_DIRS or CURL_INCLUDE_DIRS so we need to use
- # find_package to fix it
- if ("${CURL_INCLUDE_DIRS}" STREQUAL "" AND "${CURL_LIBRARIES}" STREQUAL "")
- message(STATUS "Could not find curl include or library path, falling back to find with config.")
- find_package(CURL)
- set(CURL_LIBRARIES CURL::libcurl)
- else ()
- message(STATUS " Curl include directory: ${CURL_INCLUDE_DIRS}")
- List(APPEND EXTERNAL_DEPS_INCLUDE_DIRS ${CURL_INCLUDE_DIRS})
- set(CLIENT_LIBS ${CURL_LIBRARIES})
- endif ()
set(CLIENT_LIBS_ABSTRACT_NAME curl)
message(STATUS " Curl target link: ${CURL_LIBRARIES}")
endif()