1*6236dae4SAndroid Build Coastguard Worker#*************************************************************************** 2*6236dae4SAndroid Build Coastguard Worker# _ _ ____ _ 3*6236dae4SAndroid Build Coastguard Worker# Project ___| | | | _ \| | 4*6236dae4SAndroid Build Coastguard Worker# / __| | | | |_) | | 5*6236dae4SAndroid Build Coastguard Worker# | (__| |_| | _ <| |___ 6*6236dae4SAndroid Build Coastguard Worker# \___|\___/|_| \_\_____| 7*6236dae4SAndroid Build Coastguard Worker# 8*6236dae4SAndroid Build Coastguard Worker# Copyright (C) Daniel Stenberg, <[email protected]>, et al. 9*6236dae4SAndroid Build Coastguard Worker# 10*6236dae4SAndroid Build Coastguard Worker# This software is licensed as described in the file COPYING, which 11*6236dae4SAndroid Build Coastguard Worker# you should have received as part of this distribution. The terms 12*6236dae4SAndroid Build Coastguard Worker# are also available at https://curl.se/docs/copyright.html. 13*6236dae4SAndroid Build Coastguard Worker# 14*6236dae4SAndroid Build Coastguard Worker# You may opt to use, copy, modify, merge, publish, distribute and/or sell 15*6236dae4SAndroid Build Coastguard Worker# copies of the Software, and permit persons to whom the Software is 16*6236dae4SAndroid Build Coastguard Worker# furnished to do so, under the terms of the COPYING file. 17*6236dae4SAndroid Build Coastguard Worker# 18*6236dae4SAndroid Build Coastguard Worker# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19*6236dae4SAndroid Build Coastguard Worker# KIND, either express or implied. 20*6236dae4SAndroid Build Coastguard Worker# 21*6236dae4SAndroid Build Coastguard Worker# SPDX-License-Identifier: curl 22*6236dae4SAndroid Build Coastguard Worker# 23*6236dae4SAndroid Build Coastguard Worker########################################################################### 24*6236dae4SAndroid Build Coastguard Worker# Find the nghttp3 library 25*6236dae4SAndroid Build Coastguard Worker# 26*6236dae4SAndroid Build Coastguard Worker# Input variables: 27*6236dae4SAndroid Build Coastguard Worker# 28*6236dae4SAndroid Build Coastguard Worker# - `NGHTTP3_INCLUDE_DIR`: The nghttp3 include directory. 29*6236dae4SAndroid Build Coastguard Worker# - `NGHTTP3_LIBRARY`: Path to `nghttp3` library. 30*6236dae4SAndroid Build Coastguard Worker# 31*6236dae4SAndroid Build Coastguard Worker# Result variables: 32*6236dae4SAndroid Build Coastguard Worker# 33*6236dae4SAndroid Build Coastguard Worker# - `NGHTTP3_FOUND`: System has nghttp3. 34*6236dae4SAndroid Build Coastguard Worker# - `NGHTTP3_INCLUDE_DIRS`: The nghttp3 include directories. 35*6236dae4SAndroid Build Coastguard Worker# - `NGHTTP3_LIBRARIES`: The nghttp3 library names. 36*6236dae4SAndroid Build Coastguard Worker# - `NGHTTP3_VERSION`: Version of nghttp3. 37*6236dae4SAndroid Build Coastguard Worker 38*6236dae4SAndroid Build Coastguard Workerif(CURL_USE_PKGCONFIG) 39*6236dae4SAndroid Build Coastguard Worker find_package(PkgConfig QUIET) 40*6236dae4SAndroid Build Coastguard Worker pkg_check_modules(PC_NGHTTP3 "libnghttp3") 41*6236dae4SAndroid Build Coastguard Workerendif() 42*6236dae4SAndroid Build Coastguard Worker 43*6236dae4SAndroid Build Coastguard Workerfind_path(NGHTTP3_INCLUDE_DIR NAMES "nghttp3/nghttp3.h" 44*6236dae4SAndroid Build Coastguard Worker HINTS 45*6236dae4SAndroid Build Coastguard Worker ${PC_NGHTTP3_INCLUDEDIR} 46*6236dae4SAndroid Build Coastguard Worker ${PC_NGHTTP3_INCLUDE_DIRS} 47*6236dae4SAndroid Build Coastguard Worker) 48*6236dae4SAndroid Build Coastguard Worker 49*6236dae4SAndroid Build Coastguard Workerfind_library(NGHTTP3_LIBRARY NAMES "nghttp3" 50*6236dae4SAndroid Build Coastguard Worker HINTS 51*6236dae4SAndroid Build Coastguard Worker ${PC_NGHTTP3_LIBDIR} 52*6236dae4SAndroid Build Coastguard Worker ${PC_NGHTTP3_LIBRARY_DIRS} 53*6236dae4SAndroid Build Coastguard Worker) 54*6236dae4SAndroid Build Coastguard Worker 55*6236dae4SAndroid Build Coastguard Workerif(PC_NGHTTP3_VERSION) 56*6236dae4SAndroid Build Coastguard Worker set(NGHTTP3_VERSION ${PC_NGHTTP3_VERSION}) 57*6236dae4SAndroid Build Coastguard Workerelseif(NGHTTP3_INCLUDE_DIR AND EXISTS "${NGHTTP3_INCLUDE_DIR}/nghttp3/version.h") 58*6236dae4SAndroid Build Coastguard Worker set(_version_regex "#[\t ]*define[\t ]+NGHTTP3_VERSION[\t ]+\"([^\"]*)\"") 59*6236dae4SAndroid Build Coastguard Worker file(STRINGS "${NGHTTP3_INCLUDE_DIR}/nghttp3/version.h" _version_str REGEX "${_version_regex}") 60*6236dae4SAndroid Build Coastguard Worker string(REGEX REPLACE "${_version_regex}" "\\1" _version_str "${_version_str}") 61*6236dae4SAndroid Build Coastguard Worker set(NGHTTP3_VERSION "${_version_str}") 62*6236dae4SAndroid Build Coastguard Worker unset(_version_regex) 63*6236dae4SAndroid Build Coastguard Worker unset(_version_str) 64*6236dae4SAndroid Build Coastguard Workerendif() 65*6236dae4SAndroid Build Coastguard Worker 66*6236dae4SAndroid Build Coastguard Workerinclude(FindPackageHandleStandardArgs) 67*6236dae4SAndroid Build Coastguard Workerfind_package_handle_standard_args(NGHTTP3 68*6236dae4SAndroid Build Coastguard Worker REQUIRED_VARS 69*6236dae4SAndroid Build Coastguard Worker NGHTTP3_INCLUDE_DIR 70*6236dae4SAndroid Build Coastguard Worker NGHTTP3_LIBRARY 71*6236dae4SAndroid Build Coastguard Worker VERSION_VAR 72*6236dae4SAndroid Build Coastguard Worker NGHTTP3_VERSION 73*6236dae4SAndroid Build Coastguard Worker) 74*6236dae4SAndroid Build Coastguard Worker 75*6236dae4SAndroid Build Coastguard Workerif(NGHTTP3_FOUND) 76*6236dae4SAndroid Build Coastguard Worker set(NGHTTP3_INCLUDE_DIRS ${NGHTTP3_INCLUDE_DIR}) 77*6236dae4SAndroid Build Coastguard Worker set(NGHTTP3_LIBRARIES ${NGHTTP3_LIBRARY}) 78*6236dae4SAndroid Build Coastguard Workerendif() 79*6236dae4SAndroid Build Coastguard Worker 80*6236dae4SAndroid Build Coastguard Workermark_as_advanced(NGHTTP3_INCLUDE_DIR NGHTTP3_LIBRARY) 81