一、cmake是什么
1. 名词解释
CMake是一个跨平台的安装(编译)工具,可以用简单的语句来描述所有平台的安装(编译过程),详见百度百科cmake。
2. 官方网址:https://cmake.org/
二、准备
1. 返回用户主目录,将安装包下载到用户主目录下
cd ~
2. 下载cmake
wget https://cmake.org/files/v3.11/cmake-3.11.2.tar.gz
3. 解压 cmake-3.11.2.tar.gz 文件
tar -zxvf cmake-3.11.2.tar.gz
4. 切换当前目录
cd cmake-3.11.2
三、编译安装
1. 编译安装
./bootstrap --prefix=/usr/local/cmake
***出现错误提示:
---------------------------------------------
CMake 3.11.2, Copyright 2000-2018 Kitware, Inc. and Contributors
---------------------------------------------
Error when bootstrapping CMake:
Cannot find appropriate C compiler on this system.
Please specify one using environment variable CC.
See cmake_bootstrap.log for compilers attempted.
---------------------------------------------
Log of errors: /root/cmake-3.11.2/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
以及:
CMake 3.11.2, Copyright 2000-2018 Kitware, Inc. and Contributors
C compiler on this system is: cc
---------------------------------------------
Error when bootstrapping CMake:
Cannot find a C++ compiler supporting C++11 on this system.
Please specify one using environment variable CXX.
See cmake_bootstrap.log for compilers attempted.
---------------------------------------------
Log of errors: /root/cmake-3.11.2/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
等错误提示。
***原因:没有安装gcc、g++。
***解决办法:参照博主另一篇博文《CentOS7.5安装gcc、g++》安装gcc、g++。
***继续操作:
./bootstrap --prefix=/usr/local/cmake
gmake
gmake install
2. 查看所有安装的文件位置信息
more install_manifest.txt
本文介绍了如何在CentOS7.5上编译安装cmake3.11.2。首先,从官方网址下载cmake源码并解压,然后在编译过程中遇到缺少gcc和g++的问题,通过安装这两者来解决错误,最后成功编译并安装cmake,并查看了安装的文件位置。

1万+

被折叠的 条评论
为什么被折叠?



