summaryrefslogtreecommitdiffstats
path: root/cmake/modules/Findc-ares.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /cmake/modules/Findc-ares.cmake
parentInitial commit. (diff)
downloadceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz
ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/modules/Findc-ares.cmake')
-rw-r--r--cmake/modules/Findc-ares.cmake39
1 files changed, 39 insertions, 0 deletions
diff --git a/cmake/modules/Findc-ares.cmake b/cmake/modules/Findc-ares.cmake
new file mode 100644
index 000000000..93554ed28
--- /dev/null
+++ b/cmake/modules/Findc-ares.cmake
@@ -0,0 +1,39 @@
+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)
+ if(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}")
+ endif()
+
+ # to be compatible with old Seastar
+ add_library(c-ares::c-ares ALIAS c-ares::cares)
+
+ if(NOT TARGET c-ares::c-ares)
+ add_library(c-ares::c-ares ALIAS c-ares::cares)
+ endif()
+endif()