cmake 查看编译命令,以及在vscode中如何使用cmke

通过设置如下配置选项,可以生成compile_commands.json 文件,记录使用的编译命令

复制代码
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

获得现有模块列表

复制代码
cmake --help-module-list

查看命令文档

复制代码
cmake --help-command find_file

查看模块的详细信息

复制代码
cmake --help-module <name-of-module>

查看平台上的编译器标志,并写到文件中

复制代码
cmake --system-information information.txt

获得更加详细的log

复制代码
cmake --build . -- VERBOSE=1

查看全部的cmake内部变量

复制代码
cmake --help-variable-list 

cmake --help-variable-list | grep CMAKE_CURRENT_SOURCE_DIR

vscode中 cmake使用

官方文档

https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/README.md

相关推荐
ITKEY_17 小时前
emacs 文件管理Dired, the Directory Editor
linux·编辑器·emacs
行者-全栈开发1 天前
【鸿蒙心迹】三方库移植(二)——CMake 交叉编译与符号冲突排查实录(HarmonyOS 7.x)
harmonyos·cmake·交叉编译·三方库移植·ohos·符号冲突
Solange__2 天前
图片转3D导出GLB、FBX还是OBJ?按5类任务比较材质、动画与可编辑性
人工智能·3d·ai·自然语言处理·编辑器·blender·材质
2501_916008892 天前
iOS App 图标、启动屏和多语言搭配 方法,上架前使用KXBuild一次做好 App 图标
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
2501_915918412 天前
iOS 推送通知怎么实现,从 APNs p8 密钥到 iOS 真机收到第一条推送
vscode·ios·objective-c·个人开发·swift·敏捷流程
ThatMonth2 天前
vscode 编辑器怎么打开多页签,而不是覆盖已有的页签
编辑器
广东帝工2 天前
双预警防线,筑牢智慧航道水上安全屏障
编辑器
sunshine22 girl3 天前
copilot vscode 使用技巧
人工智能·vscode·编辑器
Frag0ut3 天前
Notepad++ 零基础入门:从记事本到代码编辑器的平滑过渡(2026最新版)
python·编辑器·html·json·notepad++·markdown·记事本
行走的陀螺仪3 天前
Claude Code 从入门到实战(三):Hooks、Skills、SubAgents 高级扩展
linux·编辑器·vim