From e323254466575e03d753a33c77667011626c389f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Gregorczyk?= Date: Wed, 25 Mar 2020 13:57:48 -0400 Subject: [PATCH] make -lrt linking optional On Android there is no standalone rt library and relevant symbols are provided by libc (bionic). --- introspection/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/introspection/CMakeLists.txt b/introspection/CMakeLists.txt index c5983b20da49..4328ee117e7c 100644 --- a/introspection/CMakeLists.txt +++ b/introspection/CMakeLists.txt @@ -6,8 +6,14 @@ include_directories(${CMAKE_SOURCE_DIR}/src/cc/api) include_directories(${CMAKE_SOURCE_DIR}/src/cc/libbpf/include/uapi) option(INSTALL_INTROSPECTION "Install BPF introspection tools" ON) +option(BPS_LINK_RT "Pass -lrt to linker when linking bps tool" ON) + +set(bps_libs_to_link bpf-static elf z) +if(BPS_LINK_RT) +list(APPEND bps_libs_to_link rt) +endif() add_executable(bps bps.c) -target_link_libraries(bps bpf-static elf rt z) +target_link_libraries(bps ${bps_libs_to_link}) install (TARGETS bps DESTINATION share/bcc/introspection)