cmake: bring curl-config.cmake closer to FindCURL

Set `CURL_LIBRARIES` and `CURL_INCLUDE_DIRS` variables
for compatibility with CMake's `FindCURL.cmake`:
b411d0146c/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
This commit is contained in:
Viktor Szakats 2024-06-05 22:35:48 +02:00
parent 410111b515
commit 1dec702c86
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
2 changed files with 5 additions and 0 deletions

View File

@ -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@")

View File

@ -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)