]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | find_package(PkgConfig QUIET) |
2 | ||
3 | pkg_search_module(PC_cares | |
4 | libcares) | |
5 | ||
6 | find_path(c-ares_INCLUDE_DIR | |
7 | NAMES ares_dns.h | |
8 | PATHS ${PC_cares_INCLUDE_DIRS}) | |
9 | ||
10 | find_library(c-ares_LIBRARY | |
11 | NAMES cares | |
12 | PATHS ${PC_cares_LIBRARY_DIRS}) | |
13 | ||
14 | set(c-ares_VERSION ${PC_cares_VERSION}) | |
15 | ||
16 | include(FindPackageHandleStandardArgs) | |
17 | ||
18 | find_package_handle_standard_args(c-ares | |
19 | REQUIRED_VARS | |
20 | c-ares_INCLUDE_DIR | |
21 | c-ares_LIBRARY | |
22 | VERSION_VAR c-ares_VERSION) | |
23 | ||
1e59de90 TL |
24 | if(c-ares_FOUND) |
25 | if(NOT TARGET c-ares::cares) | |
26 | add_library(c-ares::cares UNKNOWN IMPORTED GLOBAL) | |
27 | set_target_properties(c-ares::cares PROPERTIES | |
28 | INTERFACE_INCLUDE_DIRECTORIES "${c-ares_INCLUDE_DIR}" | |
29 | IMPORTED_LINK_INTERFACE_LANGUAGES "C" | |
30 | IMPORTED_LOCATION "${c-ares_LIBRARY}") | |
31 | endif() | |
32 | ||
33 | # to be compatible with old Seastar | |
34 | add_library(c-ares::c-ares ALIAS c-ares::cares) | |
35 | ||
36 | if(NOT TARGET c-ares::c-ares) | |
37 | add_library(c-ares::c-ares ALIAS c-ares::cares) | |
38 | endif() | |
11fdf7f2 | 39 | endif() |