c项目生成compile_commands.json
作者:互联网
一、生成compile_commands.json
1.1、compile_commands.json内容
cmake生成compile_commands.jsonls
https://blog.csdn.net/qq_23599965/article/details/90697236
方法
cmake ../Main -DCMAKE_EXPORT_COMPILE_COMMANDS=1
提取结果
[
{
"directory": "/root/data/clang-llvm/TestProject/build",
"command": "/bin/c++ -I/root/data/clang-llvm/TestProject/Main/include -o CMakeFiles/t.dir/t.cpp.o -c /root/data/clang-llvm/TestProject/Main/t.cpp",
"file": "/root/data/clang-llvm/TestProject/Main/t.cpp"
}
]
1.2、bear生成compile_commands.json
以bash为例子
代码仓库
https://git.savannah.gnu.org/cgit/bash.git
mkdir build
cd build
bear -- ../configure --prefix=//media/data/clang-llvm/bash/build
bear - make
标签:commands,llvm,clang,compile,json,Main,data 来源: https://www.cnblogs.com/xine/p/16689250.html