---
title: 安装cmake
description: 1. 使用PuTTY工具，以root用户登录服务器。
url: "https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpcindapp/prtg-osc/kylin_kunpeng_must_180_02_0007.html"
---

# 安装cmake

#### 操作步骤

1. 使用PuTTY工具，以root用户登录服务器。
2. 执行以下命令加载spack环境变量。

```
source
/path/to
/spack/share/spack/setup-env.sh
```


3. 执行以下命令安装cmake 3.9.0。

```
spack -k install
cmake@3.9.0%gcc@7.3.0
```


  请使用3.9版本的cmake，其他cmake可能报以下错误。 Could NOT find MPI_Fortran (missing: MPI_Fortran_WORKS) CMake Error at /usr/local/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message): Could NOT find MPI (missing: MPI_Fortran_FOUND) (found version "3.1")

4. 执行以下命令加载cmake 3.9.0。

```
spack load cmake
```
