cmake 生成 compile_commands.json

New in version 3.5.

Enable/Disable output of compile commands during generation.

This option is implemented only by Makefile Generators and the Ninja. It is ignored on other generators.

Makefile Generators

Borland Makefiles
MSYS Makefiles
MinGW Makefiles
NMake Makefiles
NMake Makefiles JOM
Unix Makefiles
Watcom WMake

打开 vs 的 console

可先手动打开,然后使用process hacker查看程序启动的命令,就可以找到如下命令,可从控制台打开vs 的 console,不用手动打开:

cmd /k "C:\Program Files\Microsoft Visual Studio\xxxx\yyyy\VC\Auxiliary\Build\vcvars64.bat"

在打开的vs cosole中输入:

cmake .. -G "NMake Makefiles" -DCMAKE_EXPORT_COMPILE_COMMANDS=1

生成compile_commands.json

posted @ 2021-11-09 18:03  fndefbwefsowpvqfx  阅读(1348)  评论(0编辑  收藏  举报