For CMake driven C/C++ projects, compile_commands.json generation can be slightly painful, especially for mixed language projects 1. A simpler route involves clangd support for compile_flags.txt, which includes simple newline-separated list of flags.

For my recent contributions to the mini-metatomic project, the file looked like this:

1-I/usr/include/python3.13/
2-I./metatomic-core/include
3-fopenmp

Which allows LSP support in emacs to function correctly without a compile_commands.json.