reddit / emacs

How to tell CCLS where to look for compile_commands.json

Dumb-Ptr · 2022-05-13 17:20
Just as the title says. I generate compile_commands.json with cmake in the project_root/build directory
MangyCanine · 2022-05-13 22:10
In the same directory as `compile_commands.json` (which must be in a **parent** directory of the sources, do: touch .ccls_root From the FAQ: https://github.com/MaskRay/ccls/wiki/FAQ
holgerschurig · 2022-05-14 13:51
If all fails, you can switch to clang instead. There you can use `--compile-commands-dir=<string>`. BTW, I never used ccls. Do you know both clangd and ccls? Do you see a benefit in one over the over? In clangd, I like it that I can enable the clang-tidy warnings. And that I can extensively control them with my own `./clang-tidy` config file. Still I use gcc to compile my programs. So I have both: the edit-time warnings from clangd, and the compile time warnings from gcc.
holgerschurig · 2022-05-14 13:52
Why only parent directory? Tools like meson (and AFAIK also cmake, but sure here) create the compile-commands database in a subdirectory, e.g. in `build/`.