• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# - Try to find libngtcp2_crypto_quictls
2# Once done this will define
3#  LIBNGTCP2_CRYPTO_QUICTLS_FOUND        - System has libngtcp2_crypto_quictls
4#  LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIRS - The libngtcp2_crypto_quictls include directories
5#  LIBNGTCP2_CRYPTO_QUICTLS_LIBRARIES    - The libraries needed to use libngtcp2_crypto_quictls
6
7find_package(PkgConfig QUIET)
8pkg_check_modules(PC_LIBNGTCP2_CRYPTO_QUICTLS QUIET libngtcp2_crypto_quictls)
9
10find_path(LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIR
11  NAMES ngtcp2/ngtcp2_crypto_quictls.h
12  HINTS ${PC_LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIRS}
13)
14find_library(LIBNGTCP2_CRYPTO_QUICTLS_LIBRARY
15  NAMES ngtcp2_crypto_quictls
16  HINTS ${PC_LIBNGTCP2_CRYPTO_QUICTLS_LIBRARY_DIRS}
17)
18
19if(LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIR)
20  set(_version_regex "^#define[ \t]+NGTCP2_VERSION[ \t]+\"([^\"]+)\".*")
21  file(STRINGS "${LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIR}/ngtcp2/version.h"
22    LIBNGTCP2_CRYPTO_QUICTLS_VERSION REGEX "${_version_regex}")
23  string(REGEX REPLACE "${_version_regex}" "\\1"
24    LIBNGTCP2_CRYPTO_QUICTLS_VERSION "${LIBNGTCP2_CRYPTO_QUICTLS_VERSION}")
25  unset(_version_regex)
26endif()
27
28include(FindPackageHandleStandardArgs)
29# handle the QUIETLY and REQUIRED arguments and set
30# LIBNGTCP2_CRYPTO_QUICTLS_FOUND to TRUE if all listed variables are
31# TRUE and the requested version matches.
32find_package_handle_standard_args(Libngtcp2_crypto_quictls REQUIRED_VARS
33                                  LIBNGTCP2_CRYPTO_QUICTLS_LIBRARY
34                                  LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIR
35                                  VERSION_VAR LIBNGTCP2_CRYPTO_QUICTLS_VERSION)
36
37if(LIBNGTCP2_CRYPTO_QUICTLS_FOUND)
38  set(LIBNGTCP2_CRYPTO_QUICTLS_LIBRARIES ${LIBNGTCP2_CRYPTO_QUICTLS_LIBRARY})
39  set(LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIRS ${LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIR})
40endif()
41
42mark_as_advanced(LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIR
43                 LIBNGTCP2_CRYPTO_QUICTLS_LIBRARY)
44