1# Copyright (c) Facebook, Inc. 2# Licensed under the Apache License, Version 2.0 (the "License") 3 4include_directories(${PROJECT_BINARY_DIR}/src/cc) 5include_directories(${PROJECT_SOURCE_DIR}/src/cc) 6include_directories(${PROJECT_SOURCE_DIR}/src/cc/api) 7include_directories(${PROJECT_SOURCE_DIR}/src/cc/libbpf/include/uapi) 8 9set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") 10set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") 11 12option(INSTALL_CPP_EXAMPLES "Install C++ examples. Those binaries are statically linked and can take plenty of disk space" OFF) 13 14file(GLOB EXAMPLES *.cc) 15foreach(EXAMPLE ${EXAMPLES}) 16 get_filename_component(NAME ${EXAMPLE} NAME_WE) 17 add_executable(${NAME} ${EXAMPLE}) 18 19 if(NOT CMAKE_USE_LIBBPF_PACKAGE) 20 target_link_libraries(${NAME} bcc-static) 21 else() 22 target_link_libraries(${NAME} bcc-shared) 23 endif() 24 25 if(INSTALL_CPP_EXAMPLES) 26 install (TARGETS ${NAME} DESTINATION share/bcc/examples/cpp) 27 endif(INSTALL_CPP_EXAMPLES) 28endforeach() 29 30add_subdirectory(pyperf) 31