通過設置如下配置選項,可以生成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