# 构建操作

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

> **TL;DR**
> `构建`  在主菜单中

用于构建、清理和安装项目的操作被分组在主菜单的   构建   部分。

下表描述了   构建   操作如何适用于以下类型的项目：

* [CMake](quick-cmake-tutorial.html)，

* [Makefile](makefiles-support.html)，

* [Meson](meson.html)，

* [Compilation Database](compilation-database.html)，带有 [自定义构建目标](custom-build-targets.html) 和 [自定义运行/调试配置](custom-build-targets.html#custom-rundebug)。

## CMake 项目的构建操作

|    操作    |    描述    |
|  构建项目  |  从为当前项目配置的每个 [CMake 配置文件](cmake-profile.html) 构建  `all`  目标：   ![构建项目操作](https://resources.jetbrains.com/help/img/idea/2026.3/调试配置](run-debug-configuration.html)。  |
|  重新编译 <current file>  |     [编译](compiling-single-file.html)当前打开的文件或项目视图中选定的一组文件。 当用于多个文件时，重新编译在第一个编译失败时停止。     |
|  安装  |  为当前选定的 CMake 配置文件运行  `cmake install` （有关更多信息，请参阅 [CMake 安装](using-cmake-install.html)）。  |
|  重新构建项目  |     为所有 CMake 配置文件调用   清理  ，然后调用   构建项目  。     |
|  在 <selected profile> 中重新构建全部  |  调用   清理  ，然后调用   在 <selected profile> 中构建全部  。  |
|  重新构建 <selected configuration>  |     调用   清理  ，然后调用   构建 <selected configuration>  ：      ![重新构建配置](https://resources.jetbrains.com/help/img/idea/2026.3/cl_rebuildconfig.png)  |
|  清理  |  通过从当前 CMake 配置文件构建  `clean`  目标来清理项目。  |

## Makefile 项目的构建操作

|    操作    |    描述    |
|  构建项目  |  为   构建目标   字段中指定的目标或（如果   构建目标   为空）为项目顶层 [Makefile 设置](makefiles-support.html#makefile-settings)中的第一个目标调用  `make` 。  |
|  构建 <selected configuration>  |  为选定的 [配置](makefiles-support.html#rd-configs) 中指定的目标调用  `make` 。  |
|  重新编译 <current file>  |     [编译](compiling-single-file.html)当前打开的文件或项目视图中选定的一组文件。 当用于多个文件时，重新编译在第一个编译失败时停止。     |
|  重新构建项目  |  为   构建目标   和   清理目标   的 Makefile 设置中指定的目标调用  `make clean`  和  `make` 。 如果   构建目标   为空，则使用项目顶层 Makefile 中的第一个目标。  |
|  重新构建 <selected configuration>  |  为选定配置中指定的目标调用  `make clean`  和  `make` 。  |
|  清理  |  为选定配置中指定的目标调用  `make clean` 。  |

## Meson 项目的构建操作

|    操作    |    描述    |
|  构建项目  |  调用  `meson compile` 。  |
|  构建 <target>  |  调用  `meson compile <target>` 。  |
|  重新编译 <current file>  |     [编译](compiling-single-file.html)当前打开的文件或项目视图中选定的一组文件。 当用于多个文件时，重新编译在第一个编译失败时停止。     |
|  重新构建项目  |     调用  `meson compile --clean`  清理项目，然后调用  `meson compile` 。     |
|  重新构建 <target>  |     调用  `meson compile --clean`  清理项目，然后调用  `meson compile <target>` 。     |
|  清理  |  调用  `meson compile --clean`  清理项目。  |

## Compilation Database 项目的构建操作

|    操作    |    描述    |
| --- | --- |
|  构建项目  |  对于自定义构建目标：调用第一个目标的   构建   工具。  |
|  构建 <selected configuration>  |  对于自定义运行/调试配置：调用选定配置中指定目标的   构建   工具。  |
|  重新编译 <current file>  |     [编译](compiling-single-file.html)当前打开的文件或项目视图中选定的一组文件。 当用于多个文件时，重新编译在第一个编译失败时停止。     |
|  重新构建项目  |  对于自定义构建目标：调用   清理   工具，然后调用第一个目标的   构建   工具。  |
|  重新构建 <selected configuration>  |  对于自定义运行/调试配置：调用   清理  ，然后调用选定配置中指定目标的   构建   工具。  |
|  清理  |  对于自定义运行/调试配置：调用选定配置中指定目标的   清理   工具。  |

## See also

### 操作指南

[快速 CMake 教程](quick-cmake-tutorial.html) [无需构建即可编译文件](compiling-single-file.html) [CMake 安装](using-cmake-install.html)

