From 8aa74658fe7c6d6001fe78c677cf52a03f0a9b5f Mon Sep 17 00:00:00 2001 From: Dhanya16 Date: Mon, 31 Aug 2026 16:18:33 +0530 Subject: [PATCH] examples/c: rebuild BPF objects on header changes in CMake Signed-off-by: Dhanya16 --- examples/c/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/c/CMakeLists.txt b/examples/c/CMakeLists.txt index c5b0c928..dfd6472d 100644 --- a/examples/c/CMakeLists.txt +++ b/examples/c/CMakeLists.txt @@ -118,7 +118,11 @@ foreach(app ${apps}) get_filename_component(app_stem ${app} NAME_WE) # Build object skeleton and depend skeleton on libbpf build - bpf_object(${app_stem} ${app_stem}.bpf.c) + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${app_stem}.h") + bpf_object(${app_stem} ${app_stem}.bpf.c ${app_stem}.h) + else() + bpf_object(${app_stem} ${app_stem}.bpf.c) + endif() add_dependencies(${app_stem}_skel libbpf bpftool) add_executable(${app_stem} ${app_stem}.c)