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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM