Location of compile_commands.json #30
Replies: 6 comments
-
I am not very fond of the "copy" method. I added to CDT's default CMake project the |
Beta Was this translation helpful? Give feedback.
-
For clangd the compile_commands.json location can also be set via a protocol extension https://clangd.llvm.org/extensions#compilation-commands. According to the documentation it would be also possible to get rid of the compile_commands.json and instead providing it using a language server call. |
Beta Was this translation helpful? Give feedback.
-
This could be a proper solution when using a LS per project (see #25). The current LSP4E implementation starts a new LS instance for every file which is not part of a project (e.g. external system header). In this case, clangd cannot find a compile_commands.json. The approach above could be a proper solution in this case. |
Beta Was this translation helpful? Give feedback.
-
I just saw that there is also a flag to specify the path for the compile_commands.json: clangd compilation flags options:
|
Beta Was this translation helpful? Give feedback.
-
Yes, I know. The usage depends on vendor implementation. I think its not very practical, especially when the location can vary depending on e.g. active build configuration. |
Beta Was this translation helpful? Give feedback.
-
in this case I would consider allowing eclipse variables in the path to DB, like ${project_loc} |
Beta Was this translation helpful? Give feedback.
-
IMO the location of the compile_commands.json in a C/C++ project should be part of the toolchain and/or builder. You can tell clangd where to find it by either:
This will be covered by the current lsp implementation.
Any other opinions?
Beta Was this translation helpful? Give feedback.
All reactions