libbpf / libbpf-bootstrap

Scaffolding for BPF application development with libbpf and BPF CO-RE
BSD 3-Clause "New" or "Revised" License
1.09k stars 294 forks source link

cmake: Allow additional header deps for `bpf_object` #280

Closed ShawnZhong closed 3 months ago

ShawnZhong commented 3 months ago

It is quite common that a .bpf.c file depends on a header file.

However, the current FindBpfObject.cmake does not allow one to specify such dependency, so modification to the header file does not trigger recompilation of the BPF object file (and subsequent skeleton header).

This PR addresses the issue by allowing one to write, for example,

bpf_object(app app.bpf.c app.h utils.h)

So that the change to the header files (app.h and utils.h is tracked).

ShawnZhong commented 3 months ago

cc: @danobi who wrote the original FindBpfObject.cmake

danobi commented 3 months ago

sorry, missed notification. LGTM