File: Findc-ares.cmake

package info (click to toggle)
trantor 1.5.24%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,076 kB
  • sloc: cpp: 17,042; sh: 42; makefile: 8
file content (30 lines) | stat: -rw-r--r-- 824 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#[[
# Try to find c-ares library Once done this will define
#
# c-ares_FOUND - system has c-ares
# C-ARES_INCLUDE_DIRS - The c-ares include directory
# C-ARES_LIBRARIES - Link these to use c-ares
# c-ares_lib - Imported Targets
#
# Copyright (c) 2020 antao <antao2002@gmail.com>
#]]

find_path(C-ARES_INCLUDE_DIRS ares.h)
find_library(C-ARES_LIBRARIES NAMES cares)
if(C-ARES_INCLUDE_DIRS AND C-ARES_LIBRARIES)
  add_library(c-ares_lib INTERFACE IMPORTED)
  set_target_properties(
    c-ares_lib
    PROPERTIES
    INTERFACE_INCLUDE_DIRECTORIES "${C-ARES_INCLUDE_DIRS}" INTERFACE_LINK_LIBRARIES "${C-ARES_LIBRARIES}"
  )
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
  c-ares
  DEFAULT_MSG
  C-ARES_INCLUDE_DIRS
  C-ARES_LIBRARIES
)
mark_as_advanced(C-ARES_INCLUDE_DIRS C-ARES_LIBRARIES)