Improve clangd tooling
Hi,
if one works with some editor supporting the clangd/LSP tooling (Kate, Atom, VS Code, ...), one thing that always needs to be done is:
- ensure CMake export the compilation database => add
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
to cmake-options - later ensure you link the created database to your source dirs, otherwise clangd always has issues (at least for most editors), see e.g. https://releases.llvm.org/11.0.0/tools/clang/docs/HowToSetupToolingForLLVM.html
Now I want to know:
For step 1) => would it be acceptable to just always pass the -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
to cmake per default in e.g. _safe_run_cmake, if that is the right place? I would prepare a trivial merge request for that. I can not image this being any issue, as that option is supported since years by cmake and it will just be one more file in the build directory.
For step 2) => would be some option for kdesrc-build be acceptable to automatically do that linking? At the moment I always do this manually (and I assume others, too), I think it would improve the developer experience if we could do this at least optionally automatically. If that would be acceptable, I would try to add an option for this as an additional merge request.