# CMake 缓存

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/zh-cn/help/clion/llms.txt).

CMake 会在  `CMakeCache.txt`  文件中缓存变量和设置。 首次加载项目时，该文件会根据 [CMakeLists.txt](cmakelists-txt-file.html) 的内容在构建目录（  `cmake-build-debug`  或  `cmake-build-release` ，默认情况下）中生成。

如果需要，您可以将  `CMakeCache.txt`  作为普通文本文件打开并编辑。 为此，请点击 ![](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.fileTypes.config.svg)中的   CMake 工具窗口  ，或在项目树中找到该文件。

您可以在 [CMake 配置文件设置](cmake-profile.html#cmake-cache-variables) 中查看和编辑 CMake 缓存变量的值。

Procedure: 重置 CMake 缓存

要在不影响 CLion 缓存的情况下重置 CMake 缓存，请执行以下操作之一：

* 从主菜单中选择  `工具 | CMake | 重置缓存并重新加载项目` 。

* 点击 ![](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.settings.svg) 图标，位于 [CMake 工具窗口](cmake.html) 中，然后选择 ![](https://resources.jetbrains.com/help/img/idea/2026.3/app.actions.forceRefresh.svg)   重置缓存并重新加载项目  ：

![CMake 工具窗口中的重置缓存并重新加载项目选项](https://resources.jetbrains.com/help/img/idea/2026.3/cl_cmake_resetcache_toolwindow.png)

* 使用   查找操作  对话框（ `Ctrl+Shift+A` (Windows), `⌘ ⇧ A` (macOS), `⌘ ⇧ A` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ P` (macOS System Shortcuts), `Ctrl+Shift+A` (XWin), `Ctrl+Shift+A` (GNOME), `Ctrl+Shift+A` (KDE), `Escape, X` (Emacs), `Ctrl+Shift+P` (Sublime Text), `⌘ ⇧ P` (Sublime Text (macOS)), `⌘ ⇧ A` (Xcode), `Ctrl+Shift+A` (Visual Studio), `⌘ ⇧ A` (Visual Studio (macOS)), `Ctrl+Shift+A` (ReSharper), `⌘ ⇧ A` (ReSharper (macOS)), `Ctrl+Shift+A` (QtCreator), `⌘ ⇧ A` (QtCreator (macOS)), `Ctrl+I` (NetBeans), `Ctrl+Shift+A` (Eclipse), `⌘ 3` (Eclipse (macOS))）调用   重置缓存并重新加载项目  。

> **Tip:**
> 您还可以在  `设置 | 键位图` 中 [分配快捷键](configuring-keyboard-and-mouse-shortcuts.html#add-keyboard-shortcut)以执行此操作。

> **Note:**
> 重置 CMake 缓存会使 [环境文件](how-to-create-toolchain-in-clion.html#env-scripts) 缓存失效。

## See also

### 流程

[Quick CMake Tutorial](quick-cmake-tutorial.html)

