how do I set up linux headers with cmake in vscode ? ubuntu

I have a hard time setting a correct paths with cmake for “linux headers”.
I installed linux 24 and those 2 directories were already there in “/usr/src/” directory,


then I installed build-essential package
after that I created simple cmake project in vscode and tried to include those headers
but it gives errors that headers isn’t found rwonce.h , pid.h … in other words lot of errors

Can please anyone tell me how to prepare cmake/vscode correctly for linux kernel development and automatically include all headers and dependencies in cmake ?

/usr/src is not a directory searched for by default. You’ll need to add the right path to target_include_directories or include_directories (probably found using find_file) so that the compiler knows to look in the right place(s).