1 # - Try to find libnghttp3
2 # Once done this will define
3 # LIBNGHTTP3_FOUND - System has libnghttp3
4 # LIBNGHTTP3_INCLUDE_DIRS - The libnghttp3 include directories
5 # LIBNGHTTP3_LIBRARIES - The libraries needed to use libnghttp3
7 find_package(PkgConfig QUIET)
8 pkg_check_modules(PC_LIBNGHTTP3 QUIET libnghttp3)
10 find_path(LIBNGHTTP3_INCLUDE_DIR
11 NAMES nghttp3/nghttp3.h
12 HINTS ${PC_LIBNGHTTP3_INCLUDE_DIRS}
14 find_library(LIBNGHTTP3_LIBRARY
16 HINTS ${PC_LIBNGHTTP3_LIBRARY_DIRS}
19 if(LIBNGHTTP3_INCLUDE_DIR)
20 set(_version_regex "^#define[ \t]+NGHTTP3_VERSION[ \t]+\"([^\"]+)\".*")
21 file(STRINGS "${LIBNGHTTP3_INCLUDE_DIR}/nghttp3/version.h"
22 LIBNGHTTP3_VERSION REGEX "${_version_regex}")
23 string(REGEX REPLACE "${_version_regex}" "\\1"
24 LIBNGHTTP3_VERSION "${LIBNGHTTP3_VERSION}")
28 include(FindPackageHandleStandardArgs)
29 # handle the QUIETLY and REQUIRED arguments and set LIBNGHTTP3_FOUND
30 # to TRUE if all listed variables are TRUE and the requested version
32 find_package_handle_standard_args(Libnghttp3 REQUIRED_VARS
33 LIBNGHTTP3_LIBRARY LIBNGHTTP3_INCLUDE_DIR
34 VERSION_VAR LIBNGHTTP3_VERSION)
37 set(LIBNGHTTP3_LIBRARIES ${LIBNGHTTP3_LIBRARY})
38 set(LIBNGHTTP3_INCLUDE_DIRS ${LIBNGHTTP3_INCLUDE_DIR})
41 mark_as_advanced(LIBNGHTTP3_INCLUDE_DIR LIBNGHTTP3_LIBRARY)