diff --git a/CMakeLists.txt b/CMakeLists.txt index 17769cc0..f1fe2e42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,15 +86,6 @@ endif() message(STATUS "Started CMake for ${PROJECT_NAME} v${PROJECT_VERSION}...\n") -# option to use probe read/write checks -if(DEFINED ENABLE_PROBE_READ_CHECK) - add_compile_definitions(ENABLE_PROBE_READ_CHECK=1) -endif() - -if(DEFINED ENABLE_PROBE_WRITE_CHECK) - add_compile_definitions(ENABLE_PROBE_WRITE_CHECK=1) -endif() - # if option to build without libbpf is set if(${BPFTIME_BUILD_WITH_LIBBPF}) add_definitions(-DBPFTIME_BUILD_WITH_LIBBPF=1) @@ -169,6 +160,15 @@ add_subdirectory(attach) add_subdirectory(runtime) +# option to use probe read/write checks +if(DEFINED ENABLE_PROBE_READ_CHECK) + target_compile_definitions(runtime PRIVATE ENABLE_PROBE_READ_CHECK=1) +endif() + +if(DEFINED ENABLE_PROBE_WRITE_CHECK) + target_compile_definitions(runtime PRIVATE ENABLE_PROBE_WRITE_CHECK=1) +endif() + # add to single archive if option is enabled if(${BPFTIME_BUILD_STATIC_LIB}) set(UBPF_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/vm/ubpf-vm/ubpf) diff --git a/cmake/StandardSettings.cmake b/cmake/StandardSettings.cmake index 95f29580..1f126f84 100644 --- a/cmake/StandardSettings.cmake +++ b/cmake/StandardSettings.cmake @@ -87,4 +87,10 @@ option(BPFTIME_BUILD_KERNEL_BPF "Whether to build with bpf share maps" ON) option(BPFTIME_BUILD_STATIC_LIB "Whether to build a single static library for different archive files" OFF) # whether to build bpftime with libbpf and other linux headers -option(BPFTIME_BUILD_WITH_LIBBPF "Whether to build with libbpf and other linux headers" ON) \ No newline at end of file +option(BPFTIME_BUILD_WITH_LIBBPF "Whether to build with libbpf and other linux headers" ON) + +# whether to enable probe write check +option(ENABLE_PROBE_WRITE_CHECK "Whether to enable probe write check" OFF) + +# whether to enable probe read check +option(ENABLE_PROBE_READ_CHECK "Whether to enable probe read check" OFF) \ No newline at end of file