File: CMakeLists.txt

package info (click to toggle)
bpfcc 0.18.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 12,368 kB
  • sloc: ansic: 132,727; python: 36,226; cpp: 26,973; sh: 710; yacc: 525; makefile: 141; lex: 94
file content (30 lines) | stat: -rw-r--r-- 986 bytes parent folder | download
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
# Copyright (c) Facebook, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")

include_directories(${CMAKE_BINARY_DIR}/src/cc)
include_directories(${CMAKE_SOURCE_DIR}/src/cc)
include_directories(${CMAKE_SOURCE_DIR}/src/cc/api)
include_directories(${CMAKE_SOURCE_DIR}/src/cc/libbpf/include/uapi)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")

option(INSTALL_CPP_EXAMPLES "Install C++ examples. Those binaries are statically linked and can take plenty of disk space" OFF)

file(GLOB EXAMPLES *.cc)
foreach(EXAMPLE ${EXAMPLES})
  get_filename_component(NAME ${EXAMPLE} NAME_WE)
  add_executable(${NAME} ${EXAMPLE})

  if(NOT CMAKE_USE_LIBBPF_PACKAGE)
    target_link_libraries(${NAME} bcc-static)
  else()
    target_link_libraries(${NAME} bcc-shared)
  endif()

  if(INSTALL_CPP_EXAMPLES)
    install (TARGETS ${NAME} DESTINATION share/bcc/examples/cpp)
  endif(INSTALL_CPP_EXAMPLES)
endforeach()

add_subdirectory(pyperf)