Clangd Config CMakeLists. txt
Vim using Coc-nvim plugin clangd-lsp
need to read CMakeLists.txt
so that it can auto-complete your code.
If your project builds with CMake, it can generate this file. You should enable it with:
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 |
Or add to CMakeLists.txt
:
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) |
compile_commands.json
will be written to your build directory. If your build directory is $SRC
or $SRC/build
, clangd will find it. Otherwise, symlink or copy it to $SRC
, the root of your source tree.
ln -s ~/myproject-build/compile_commands.json ~/myproject/ |
Generated compile_commands.json
can support auto completion for third party libraries.
- 本文标题:Clangd Config CMakeLists. txt
- 创建时间:2023-05-25 17:34:01
- 本文链接:2023/05/25/note/Programming/evn/cpp_config/
- 版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
显示评论