You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Visual Studio 2022中禁用CMake脚本建议更改提示

关闭CMake新建文件时的Preview Changes弹窗

针对CLion用户

  1. 打开设置(快捷键Ctrl+Alt+S,或顶部菜单File > Settings)
  2. 依次展开Build, Execution, Deployment > CMake
  3. 在右侧「Automatic CMake project reloading」区域,取消勾选「Show preview window when changes are suggested」
  4. 也可以直接在设置搜索框输入「CMake Preview Changes」,找到对应选项关闭

如果想彻底关掉自动提示添加文件的功能:

  1. 打开设置后进入Editor > General > Auto Import
  2. 取消勾选CMake相关的「Add imported files to CMake targets automatically」选项

针对Visual Studio用户

  1. 顶部菜单点击工具 > 选项(Tools > Options)
  2. 展开CMake > General
  3. 取消勾选「Prompt for changes when files are added or removed from the project」

额外提示

如果你一直用file(GLOB_RECURSE)批量导入头文件,确保CMakeLists.txt写法规范,比如:

# 批量获取所有头文件
file(GLOB_RECURSE PROJECT_HEADERS "include/*.h")
# 将头文件关联到目标
target_sources(YourProjectName PRIVATE ${PROJECT_HEADERS})

规范写法能减少IDE的不必要提示。

内容的提问来源于stack exchange,提问作者Lex

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 08:01:05