mirror of
https://github.com/curl/curl.git
synced 2026-07-26 14:57:17 +03:00
cmake: namespace all local variables in curl-config.cmake
Also: - apply it to the local copy of this code in `lib/CMakeLists.txt`. - replace 'CURL' with `@PROJECT_NAME@` in a message. Closes #19777
This commit is contained in:
parent
729316a9e4
commit
dabfae84f0
2 changed files with 51 additions and 51 deletions
|
|
@ -42,93 +42,93 @@ endif()
|
|||
set(_curl_cmake_module_path_save ${CMAKE_MODULE_PATH})
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_MODULE_PATH})
|
||||
|
||||
set(_libs "")
|
||||
set(_curl_libs "")
|
||||
|
||||
if("@HAVE_BROTLI@")
|
||||
find_dependency(Brotli)
|
||||
list(APPEND _libs CURL::brotli)
|
||||
list(APPEND _curl_libs CURL::brotli)
|
||||
endif()
|
||||
if("@USE_ARES@")
|
||||
find_dependency(Cares)
|
||||
list(APPEND _libs CURL::cares)
|
||||
list(APPEND _curl_libs CURL::cares)
|
||||
endif()
|
||||
if("@HAVE_GSSAPI@")
|
||||
find_dependency(GSS)
|
||||
list(APPEND _libs CURL::gss)
|
||||
list(APPEND _curl_libs CURL::gss)
|
||||
endif()
|
||||
if("@USE_BACKTRACE@")
|
||||
find_dependency(Libbacktrace)
|
||||
list(APPEND _libs CURL::libbacktrace)
|
||||
list(APPEND _curl_libs CURL::libbacktrace)
|
||||
endif()
|
||||
if("@USE_GSASL@")
|
||||
find_dependency(Libgsasl)
|
||||
list(APPEND _libs CURL::libgsasl)
|
||||
list(APPEND _curl_libs CURL::libgsasl)
|
||||
endif()
|
||||
if(NOT "@USE_WIN32_LDAP@" AND NOT "@CURL_DISABLE_LDAP@")
|
||||
find_dependency(LDAP)
|
||||
list(APPEND _libs CURL::ldap)
|
||||
list(APPEND _curl_libs CURL::ldap)
|
||||
endif()
|
||||
if("@HAVE_LIBIDN2@")
|
||||
find_dependency(Libidn2)
|
||||
list(APPEND _libs CURL::libidn2)
|
||||
list(APPEND _curl_libs CURL::libidn2)
|
||||
endif()
|
||||
if("@USE_LIBPSL@")
|
||||
find_dependency(Libpsl)
|
||||
list(APPEND _libs CURL::libpsl)
|
||||
list(APPEND _curl_libs CURL::libpsl)
|
||||
endif()
|
||||
if("@USE_LIBRTMP@")
|
||||
find_dependency(Librtmp)
|
||||
list(APPEND _libs CURL::librtmp)
|
||||
list(APPEND _curl_libs CURL::librtmp)
|
||||
endif()
|
||||
if("@USE_LIBSSH@")
|
||||
find_dependency(Libssh)
|
||||
list(APPEND _libs CURL::libssh)
|
||||
list(APPEND _curl_libs CURL::libssh)
|
||||
endif()
|
||||
if("@USE_LIBSSH2@")
|
||||
find_dependency(Libssh2)
|
||||
list(APPEND _libs CURL::libssh2)
|
||||
list(APPEND _curl_libs CURL::libssh2)
|
||||
endif()
|
||||
if("@USE_LIBUV@")
|
||||
find_dependency(Libuv)
|
||||
list(APPEND _libs CURL::libuv)
|
||||
list(APPEND _curl_libs CURL::libuv)
|
||||
endif()
|
||||
if("@USE_MBEDTLS@")
|
||||
find_dependency(MbedTLS)
|
||||
list(APPEND _libs CURL::mbedtls)
|
||||
list(APPEND _curl_libs CURL::mbedtls)
|
||||
endif()
|
||||
if("@USE_NGHTTP2@")
|
||||
find_dependency(NGHTTP2)
|
||||
list(APPEND _libs CURL::nghttp2)
|
||||
list(APPEND _curl_libs CURL::nghttp2)
|
||||
endif()
|
||||
if("@USE_NGHTTP3@")
|
||||
find_dependency(NGHTTP3)
|
||||
list(APPEND _libs CURL::nghttp3)
|
||||
list(APPEND _curl_libs CURL::nghttp3)
|
||||
endif()
|
||||
if("@USE_NGTCP2@")
|
||||
find_dependency(NGTCP2)
|
||||
list(APPEND _libs CURL::ngtcp2)
|
||||
list(APPEND _curl_libs CURL::ngtcp2)
|
||||
endif()
|
||||
if("@USE_GNUTLS@")
|
||||
find_dependency(GnuTLS)
|
||||
list(APPEND _libs CURL::gnutls)
|
||||
list(APPEND _curl_libs CURL::gnutls)
|
||||
find_dependency(Nettle)
|
||||
list(APPEND _libs CURL::nettle)
|
||||
list(APPEND _curl_libs CURL::nettle)
|
||||
endif()
|
||||
if("@USE_QUICHE@")
|
||||
find_dependency(Quiche)
|
||||
list(APPEND _libs CURL::quiche)
|
||||
list(APPEND _curl_libs CURL::quiche)
|
||||
endif()
|
||||
if("@USE_RUSTLS@")
|
||||
find_dependency(Rustls)
|
||||
list(APPEND _libs CURL::rustls)
|
||||
list(APPEND _curl_libs CURL::rustls)
|
||||
endif()
|
||||
if("@USE_WOLFSSL@")
|
||||
find_dependency(WolfSSL)
|
||||
list(APPEND _libs CURL::wolfssl)
|
||||
list(APPEND _curl_libs CURL::wolfssl)
|
||||
endif()
|
||||
if("@HAVE_ZSTD@")
|
||||
find_dependency(Zstd)
|
||||
list(APPEND _libs CURL::zstd)
|
||||
list(APPEND _curl_libs CURL::zstd)
|
||||
endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH ${_curl_cmake_module_path_save})
|
||||
|
|
@ -155,16 +155,16 @@ if(TARGET @PROJECT_NAME@::@LIB_STATIC@)
|
|||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17)
|
||||
cmake_policy(GET CMP0099 _has_CMP0099) # https://cmake.org/cmake/help/latest/policy/CMP0099.html
|
||||
endif()
|
||||
if(NOT _has_CMP0099 AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.13 AND _libs)
|
||||
set(_libdirs "")
|
||||
foreach(_lib IN LISTS _libs)
|
||||
get_target_property(_libdir "${_lib}" INTERFACE_LINK_DIRECTORIES)
|
||||
if(_libdir)
|
||||
list(APPEND _libdirs "${_libdir}")
|
||||
if(NOT _has_CMP0099 AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.13 AND _curl_libs)
|
||||
set(_curl_libdirs "")
|
||||
foreach(_curl_lib IN LISTS _curl_libs)
|
||||
get_target_property(_curl_libdir "${_curl_lib}" INTERFACE_LINK_DIRECTORIES)
|
||||
if(_curl_libdir)
|
||||
list(APPEND _curl_libdirs "${_curl_libdir}")
|
||||
endif()
|
||||
endforeach()
|
||||
if(_libdirs)
|
||||
target_link_directories(@PROJECT_NAME@::@LIB_STATIC@ INTERFACE ${_libdirs})
|
||||
if(_curl_libdirs)
|
||||
target_link_directories(@PROJECT_NAME@::@LIB_STATIC@ INTERFACE ${_curl_libdirs})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -178,25 +178,25 @@ set_and_check(CURL_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
|
|||
set(CURL_SUPPORTED_PROTOCOLS "@CURL_SUPPORTED_PROTOCOLS_LIST@")
|
||||
set(CURL_SUPPORTED_FEATURES "@CURL_SUPPORTED_FEATURES_LIST@")
|
||||
|
||||
foreach(_item IN LISTS CURL_SUPPORTED_PROTOCOLS CURL_SUPPORTED_FEATURES)
|
||||
set(CURL_SUPPORTS_${_item} TRUE)
|
||||
foreach(_curl_item IN LISTS CURL_SUPPORTED_PROTOCOLS CURL_SUPPORTED_FEATURES)
|
||||
set(CURL_SUPPORTS_${_curl_item} TRUE)
|
||||
endforeach()
|
||||
|
||||
set(_missing_req "")
|
||||
foreach(_item IN LISTS CURL_FIND_COMPONENTS)
|
||||
if(CURL_SUPPORTS_${_item})
|
||||
set(CURL_${_item}_FOUND TRUE)
|
||||
elseif(CURL_FIND_REQUIRED_${_item})
|
||||
list(APPEND _missing_req ${_item})
|
||||
set(_curl_missing_req "")
|
||||
foreach(_curl_item IN LISTS CURL_FIND_COMPONENTS)
|
||||
if(CURL_SUPPORTS_${_curl_item})
|
||||
set(CURL_${_curl_item}_FOUND TRUE)
|
||||
elseif(CURL_FIND_REQUIRED_${_curl_item})
|
||||
list(APPEND _curl_missing_req ${_curl_item})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(_missing_req)
|
||||
string(REPLACE ";" " " _missing_req "${_missing_req}")
|
||||
if(_curl_missing_req)
|
||||
string(REPLACE ";" " " _curl_missing_req "${_curl_missing_req}")
|
||||
if(CURL_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "CURL: missing required components: ${_missing_req}")
|
||||
message(FATAL_ERROR "@PROJECT_NAME@: missing required components: ${_curl_missing_req}")
|
||||
endif()
|
||||
unset(_missing_req)
|
||||
unset(_curl_missing_req)
|
||||
endif()
|
||||
|
||||
check_required_components("@PROJECT_NAME@")
|
||||
|
|
|
|||
|
|
@ -181,17 +181,17 @@ if(BUILD_STATIC_LIBS)
|
|||
cmake_policy(GET CMP0099 _has_CMP0099) # https://cmake.org/cmake/help/latest/policy/CMP0099.html
|
||||
endif()
|
||||
if(NOT _has_CMP0099 AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.13 AND CURL_LIBS)
|
||||
set(_libdirs "")
|
||||
foreach(_lib IN LISTS CURL_LIBS)
|
||||
if(TARGET "${_lib}")
|
||||
get_target_property(_libdir "${_lib}" INTERFACE_LINK_DIRECTORIES)
|
||||
if(_libdir)
|
||||
list(APPEND _libdirs "${_libdir}")
|
||||
set(_curl_libdirs "")
|
||||
foreach(_curl_lib IN LISTS CURL_LIBS)
|
||||
if(TARGET "${_curl_lib}")
|
||||
get_target_property(_curl_libdir "${_curl_lib}" INTERFACE_LINK_DIRECTORIES)
|
||||
if(_curl_libdir)
|
||||
list(APPEND _curl_libdirs "${_curl_libdir}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
if(_libdirs)
|
||||
target_link_directories(${LIB_STATIC} INTERFACE ${_libdirs})
|
||||
if(_curl_libdirs)
|
||||
target_link_directories(${LIB_STATIC} INTERFACE ${_curl_libdirs})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue