From 1cfd4e998852582abd454c934be034d7dd4ed17b Mon Sep 17 00:00:00 2001 From: Officeyutong Date: Tue, 7 Nov 2023 06:18:25 +0800 Subject: [PATCH] Link librt for libbpftime_daemon (#74) --- daemon/CMakeLists.txt | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt index f79000a9..bf452aef 100644 --- a/daemon/CMakeLists.txt +++ b/daemon/CMakeLists.txt @@ -6,8 +6,8 @@ add_bpf_skel_generating_target(bpftime_daemon_ebpf_skel ${CMAKE_CURRENT_BINARY_D add_dependencies(bpftime_daemon_ebpf_skel bpftime_daemon_ebpf_target) -add_library(libbpftime_daemon STATIC - user/bpf_tracer.cpp +add_library(libbpftime_daemon STATIC + user/bpf_tracer.cpp user/handle_bpf_event.cpp user/bpftime_driver.cpp ) @@ -16,27 +16,29 @@ add_executable(bpftime_daemon user/main.cpp ) -add_dependencies(libbpftime_daemon - bpftime_daemon_ebpf_skel - libbpf - spdlog::spdlog - runtime - ) +add_dependencies(libbpftime_daemon + bpftime_daemon_ebpf_skel + libbpf + spdlog::spdlog + runtime +) -target_include_directories(libbpftime_daemon PRIVATE - ${CMAKE_CURRENT_BINARY_DIR} +target_include_directories(libbpftime_daemon PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} ${LIBBPF_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../vm/include ${CMAKE_CURRENT_SOURCE_DIR}/../runtime/include ) -target_link_libraries(libbpftime_daemon PRIVATE - ${LIBBPF_LIBRARIES} - elf - z - spdlog::spdlog - runtime - ) +target_link_libraries(libbpftime_daemon PRIVATE + ${LIBBPF_LIBRARIES} + elf + z + spdlog::spdlog + runtime + PUBLIC + rt +) set_property(TARGET libbpftime_daemon PROPERTY CXX_STANDARD 20) add_dependencies(bpftime_daemon libbpftime_daemon) @@ -45,6 +47,5 @@ target_link_libraries(bpftime_daemon PRIVATE libbpftime_daemon) install(TARGETS bpftime_daemon CONFIGURATIONS Release Debug DESTINATION ~/.bpftime) if(BPFTIME_ENABLE_UNIT_TESTING) - add_subdirectory(test) + add_subdirectory(test) endif() -