mirror of
https://github.com/ceph/ceph
synced 2025-01-06 03:01:24 +00:00
c0ac7a2fc1
to address the build failure like: -- Checking for one of the modules 'libcares' CMake Error at cmake/modules/BuildBoost.cmake:287 (_add_library): _add_library cannot create ALIAS target "c-ares::c-ares" because target "c-ares::cares" is imported but not globally visible. Call Stack (most recent call first): cmake/modules/Findc-ares.cmake:31 (add_library) src/CMakeLists.txt:344 (find_package) Signed-off-by: Kefu Chai <tchaikov@gmail.com>
33 lines
831 B
CMake
33 lines
831 B
CMake
find_package(PkgConfig QUIET)
|
|
|
|
pkg_search_module(PC_cares
|
|
libcares)
|
|
|
|
find_path(c-ares_INCLUDE_DIR
|
|
NAMES ares_dns.h
|
|
PATHS ${PC_cares_INCLUDE_DIRS})
|
|
|
|
find_library(c-ares_LIBRARY
|
|
NAMES cares
|
|
PATHS ${PC_cares_LIBRARY_DIRS})
|
|
|
|
set(c-ares_VERSION ${PC_cares_VERSION})
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(c-ares
|
|
REQUIRED_VARS
|
|
c-ares_INCLUDE_DIR
|
|
c-ares_LIBRARY
|
|
VERSION_VAR c-ares_VERSION)
|
|
|
|
if(c-ares_FOUND AND NOT (TARGET c-ares::cares))
|
|
add_library(c-ares::cares UNKNOWN IMPORTED GLOBAL)
|
|
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()
|