mirror of
https://github.com/springzfx/cgproxy.git
synced 2026-03-15 09:32:09 +08:00
add cmake option: build_execsnoop_dl, build_static
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
# find libbpf
|
||||
find_library(LIBBPF bpf)
|
||||
if (build_static)
|
||||
find_library(LIBBPF libbpf.a)
|
||||
else()
|
||||
find_library(LIBBPF bpf)
|
||||
endif()
|
||||
|
||||
if (LIBBPF-NOTFOUND)
|
||||
message(FATAL_ERROR "libbpf not found")
|
||||
endif()
|
||||
|
||||
add_library(execsnoop MODULE execsnoop_share.cpp)
|
||||
target_link_libraries(execsnoop PRIVATE bpf)
|
||||
install(TARGETS execsnoop DESTINATION ${CMAKE_INSTALL_LIBDIR}/cgproxy/)
|
||||
if (build_execsnoop_dl)
|
||||
add_library(execsnoop MODULE execsnoop_share.cpp)
|
||||
install(TARGETS execsnoop DESTINATION ${CMAKE_INSTALL_LIBDIR}/cgproxy/)
|
||||
else()
|
||||
add_library(execsnoop execsnoop_share.cpp)
|
||||
endif()
|
||||
|
||||
target_link_libraries(execsnoop PRIVATE ${LIBBPF} -lelf -lz)
|
||||
@@ -10,9 +10,11 @@ namespace CGPROXY::EXECSNOOP {
|
||||
|
||||
extern "C" void startThread(function<int(int)> c, promise<void> _status);
|
||||
|
||||
#ifdef BUIlD_EXECSNOOP_DL
|
||||
// only for dlsym()
|
||||
using startThread_t=decltype(startThread);
|
||||
startThread_t *_startThread;
|
||||
#endif
|
||||
|
||||
} // namespace CGPROXY::EXECSNOOP
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user