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