File: FindLibbpf.cmake

package info (click to toggle)
nghttp2 1.68.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 15,592 kB
  • sloc: ansic: 104,233; cpp: 55,792; ruby: 30,108; yacc: 7,083; sh: 4,643; makefile: 1,506; python: 806
file content (32 lines) | stat: -rw-r--r-- 989 bytes parent folder | download | duplicates (3)
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
31
32
# - Try to find libbpf
# Once done this will define
#  LIBBPF_FOUND        - System has libbpf
#  LIBBPF_INCLUDE_DIRS - The libbpf include directories
#  LIBBPF_LIBRARIES    - The libraries needed to use libbpf

find_package(PkgConfig QUIET)
pkg_check_modules(PC_LIBBPF QUIET libbpf)

find_path(LIBBPF_INCLUDE_DIR
  NAMES bpf/bpf.h
  HINTS ${PC_LIBBPF_INCLUDE_DIRS}
)
find_library(LIBBPF_LIBRARY
  NAMES bpf
  HINTS ${PC_LIBBPF_LIBRARY_DIRS}
)

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBBPF_FOUND
# to TRUE if all listed variables are TRUE and the requested version
# matches.
find_package_handle_standard_args(Libbpf REQUIRED_VARS
                                  LIBBPF_LIBRARY LIBBPF_INCLUDE_DIR
                                  VERSION_VAR LIBBPF_VERSION)

if(LIBBPF_FOUND)
  set(LIBBPF_LIBRARIES     ${LIBBPF_LIBRARY})
  set(LIBBPF_INCLUDE_DIRS  ${LIBBPF_INCLUDE_DIR})
endif()

mark_as_advanced(LIBBPF_INCLUDE_DIR LIBBPF_LIBRARY)