cmake: s/c-ares::c-ares/c-ares::cares/

to be aligned with the c-ares upstream, which provides
c-ares-config.cmake in c-ares v1.17 and up. this cmake config file
is also packaged by fedora and CentOS stream in c-ares-devel-1.17.1 and
up.

this change prepares us for bumping up Seastar submodule, which also
has a similar change: aea45c98f2

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
This commit is contained in:
Kefu Chai 2022-11-22 00:44:31 +08:00
parent 50dfaf9897
commit 3121de1c70
2 changed files with 11 additions and 7 deletions

View File

@ -11,12 +11,14 @@ function(build_c_ares)
BINARY_DIR "${C-ARES_BINARY_DIR}"
BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR>
INSTALL_COMMAND "")
add_library(c-ares::c-ares STATIC IMPORTED)
add_dependencies(c-ares::c-ares c-ares_ext)
set_target_properties(c-ares::c-ares PROPERTIES
add_library(c-ares::cares STATIC IMPORTED)
add_dependencies(c-ares::cares c-ares_ext)
set_target_properties(c-ares::cares PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${C-ARES_SOURCE_DIR};${C-ARES_BINARY_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${C-ARES_BINARY_DIR}/lib/libcares.a")
# to appease find_package()
add_custom_target(c-ares DEPENDS c-ares::c-ares)
add_custom_target(c-ares DEPENDS c-ares::cares)
# to be compatible with old Seastar
add_library(c-ares::c-ares ALIAS c-ares::cares)
endfunction()

View File

@ -21,10 +21,12 @@ find_package_handle_standard_args(c-ares
c-ares_LIBRARY
VERSION_VAR c-ares_VERSION)
if(c-ares_FOUND AND NOT (TARGET c-ares::c-ares))
add_library(c-ares::c-ares UNKNOWN IMPORTED)
set_target_properties(c-ares::c-ares PROPERTIES
if(c-ares_FOUND AND NOT (TARGET c-ares::cares))
add_library(c-ares::cares UNKNOWN IMPORTED)
set_target_properties(c-ares::cares PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${c-ares_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${c-ares_LIBRARY}")
# to be compatible with old Seastar
add_library(c-ares::c-ares ALIAS c-ares::cares)
endif()