master
1#***************************************************************************
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
8# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9#
10# This software is licensed as described in the file COPYING, which
11# you should have received as part of this distribution. The terms
12# are also available at https://curl.se/docs/copyright.html.
13#
14# You may opt to use, copy, modify, merge, publish, distribute and/or sell
15# copies of the Software, and permit persons to whom the Software is
16# furnished to do so, under the terms of the COPYING file.
17#
18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19# KIND, either express or implied.
20#
21# SPDX-License-Identifier: curl
22#
23###########################################################################
24# Find the c-ares library
25#
26# Input variables:
27#
28# - `CARES_INCLUDE_DIR`: Absolute path to c-ares include directory.
29# - `CARES_LIBRARY`: Absolute path to `cares` library.
30# - `CARES_USE_STATIC_LIBS`: Configure for static c-ares libraries.
31#
32# Defines:
33#
34# - `CARES_FOUND`: System has c-ares.
35# - `CARES_VERSION`: Version of c-ares.
36# - `CURL::cares`: c-ares library target.
38set(_cares_pc_requires "libcares")
40if(NOT DEFINED CARES_INCLUDE_DIR AND
41 NOT DEFINED CARES_LIBRARY)
42 if(CURL_USE_PKGCONFIG)
43 find_package(PkgConfig QUIET)
44 pkg_check_modules(_cares ${_cares_pc_requires})
45 endif()
46 if(NOT _cares_FOUND AND CURL_USE_CMAKECONFIG)
47 find_package(c-ares CONFIG QUIET)
48 endif()
49endif()
51if(_cares_FOUND)
52 set(Cares_FOUND TRUE)
53 set(CARES_FOUND TRUE)
54 set(CARES_VERSION ${_cares_VERSION})
55 if(CARES_USE_STATIC_LIBS)
56 set(_cares_CFLAGS "${_cares_STATIC_CFLAGS}")
57 set(_cares_INCLUDE_DIRS "${_cares_STATIC_INCLUDE_DIRS}")
58 set(_cares_LIBRARY_DIRS "${_cares_STATIC_LIBRARY_DIRS}")
59 set(_cares_LIBRARIES "${_cares_STATIC_LIBRARIES}")
60 endif()
61 message(STATUS "Found Cares (via pkg-config): ${_cares_INCLUDE_DIRS} (found version \"${CARES_VERSION}\")")
62elseif(c-ares_CONFIG)
63 set(Cares_FOUND TRUE)
64 set(CARES_FOUND TRUE)
65 set(CARES_VERSION ${c-ares_VERSION})
66 if(CARES_USE_STATIC_LIBS)
67 set(_cares_LIBRARIES c-ares::cares_static)
68 else()
69 set(_cares_LIBRARIES c-ares::cares)
70 endif()
71 message(STATUS "Found Cares (via CMake Config): ${c-ares_CONFIG} (found version \"${CARES_VERSION}\")")
72else()
73 find_path(CARES_INCLUDE_DIR NAMES "ares.h")
74 if(CARES_USE_STATIC_LIBS)
75 set(_cares_CFLAGS "-DCARES_STATICLIB")
76 find_library(CARES_LIBRARY NAMES ${CARES_NAMES} "cares_static" "cares")
77 else()
78 find_library(CARES_LIBRARY NAMES ${CARES_NAMES} "cares")
79 endif()
81 unset(CARES_VERSION CACHE)
82 if(CARES_INCLUDE_DIR AND EXISTS "${CARES_INCLUDE_DIR}/ares_version.h")
83 set(_version_regex1 "#[\t ]*define[\t ]+ARES_VERSION_MAJOR[\t ]+([0-9]+).*")
84 set(_version_regex2 "#[\t ]*define[\t ]+ARES_VERSION_MINOR[\t ]+([0-9]+).*")
85 set(_version_regex3 "#[\t ]*define[\t ]+ARES_VERSION_PATCH[\t ]+([0-9]+).*")
86 file(STRINGS "${CARES_INCLUDE_DIR}/ares_version.h" _version_str1 REGEX "${_version_regex1}")
87 file(STRINGS "${CARES_INCLUDE_DIR}/ares_version.h" _version_str2 REGEX "${_version_regex2}")
88 file(STRINGS "${CARES_INCLUDE_DIR}/ares_version.h" _version_str3 REGEX "${_version_regex3}")
89 string(REGEX REPLACE "${_version_regex1}" "\\1" _version_str1 "${_version_str1}")
90 string(REGEX REPLACE "${_version_regex2}" "\\1" _version_str2 "${_version_str2}")
91 string(REGEX REPLACE "${_version_regex3}" "\\1" _version_str3 "${_version_str3}")
92 set(CARES_VERSION "${_version_str1}.${_version_str2}.${_version_str3}")
93 unset(_version_regex1)
94 unset(_version_regex2)
95 unset(_version_regex3)
96 unset(_version_str1)
97 unset(_version_str2)
98 unset(_version_str3)
99 endif()
101 include(FindPackageHandleStandardArgs)
102 find_package_handle_standard_args(Cares
103 REQUIRED_VARS
104 CARES_INCLUDE_DIR
105 CARES_LIBRARY
106 VERSION_VAR
107 CARES_VERSION
108 )
110 if(CARES_FOUND)
111 set(_cares_INCLUDE_DIRS ${CARES_INCLUDE_DIR})
112 set(_cares_LIBRARIES ${CARES_LIBRARY})
113 endif()
115 mark_as_advanced(CARES_INCLUDE_DIR CARES_LIBRARY)
116endif()
118if(CARES_FOUND)
119 if(WIN32)
120 list(APPEND _cares_LIBRARIES "iphlpapi") # for if_indextoname and others
121 endif()
123 if(NOT TARGET CURL::cares)
124 add_library(CURL::cares INTERFACE IMPORTED)
125 set_target_properties(CURL::cares PROPERTIES
126 INTERFACE_LIBCURL_PC_MODULES "${_cares_pc_requires}"
127 INTERFACE_COMPILE_OPTIONS "${_cares_CFLAGS}"
128 INTERFACE_INCLUDE_DIRECTORIES "${_cares_INCLUDE_DIRS}"
129 INTERFACE_LINK_DIRECTORIES "${_cares_LIBRARY_DIRS}"
130 INTERFACE_LINK_LIBRARIES "${_cares_LIBRARIES}")
131 endif()
132endif()
Diagnostics4 git calls · 37 ms
CallStatusSizeTime037 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B · hit3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=3 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit4 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=30 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=4 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch2001.7 KiB · hit30 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=1743 git.response.cache=HIT git.response.duration_ms=30 git.fetch.wants=26efdf87fff52f1428a6df0f7879dcacab09247a git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=1743 git.pkt.payload.max=1722 git.sideband.band1.bytes=1721 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5e30b483f0fee28
- Request
- 201caaa4…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format