From: Viktor Szakats Date: Wed, 5 Jun 2024 20:35:48 +0000 (+0200) Subject: cmake: bring `curl-config.cmake` closer to `FindCURL` X-Git-Tag: curl-8_9_0~249 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1dec702c8676fef3a7b5850e5350102876067680;p=thirdparty%2Fcurl.git cmake: bring `curl-config.cmake` closer to `FindCURL` Set `CURL_LIBRARIES` and `CURL_INCLUDE_DIRS` variables for compatibility with CMake's `FindCURL.cmake`: https://github.com/Kitware/CMake/blob/b411d0146c2e06acfb0c823bb039e99f0191b611/Modules/FindCURL.cmake#L209 For dependent projects, CMake's suggestion is to replace `CURL_LIBRARIES` with `CURL::libcurl`, and drop `CURL_INCLUDE_DIRS`. Reported-by: Aurélien Pierre Ref: https://curl.se/mail/lib-2024-06/0014.html Ref: https://gitlab.kitware.com/cmake/cmake/-/issues/24580 Closes #13897 --- diff --git a/CMake/curl-config.cmake.in b/CMake/curl-config.cmake.in index 9adb96e0aa..2ce8625ef9 100644 --- a/CMake/curl-config.cmake.in +++ b/CMake/curl-config.cmake.in @@ -38,3 +38,7 @@ check_required_components("@PROJECT_NAME@") if(NOT TARGET @PROJECT_NAME@::libcurl) add_library(@PROJECT_NAME@::libcurl ALIAS @PROJECT_NAME@::@LIB_SELECTED@) endif() + +# For compatibility with CMake's FindCURL.cmake +set(CURL_LIBRARIES @PROJECT_NAME@::libcurl) +set_and_check(CURL_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@") diff --git a/CMakeLists.txt b/CMakeLists.txt index ebbe2b1a1d..c939df914c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1855,6 +1855,7 @@ if(NOT CURL_DISABLE_INSTALL) configure_package_config_file(CMake/curl-config.cmake.in "${project_config}" INSTALL_DESTINATION ${CURL_INSTALL_CMAKE_DIR} + PATH_VARS CMAKE_INSTALL_INCLUDEDIR ) if(CURL_ENABLE_EXPORT_TARGET)