安装参考博客是《ubuntu安装cmake》和《Ubuntu 安装CMake》。
https://cmake.org/download是cmake官网下载的网址。

sudo wget -c https://github.com/Kitware/CMake/releases/download/v3.27.7/cmake-3.27.7.tar.gz可以下载源码,最后显示‘cmake-3.27.7.tar.gz’ saved [10982558/10982558]才是完成下载。

sudo tar -zxf cmake-3.27.7.tar.gz进行解压。

cd cmake-3.27.7进入源码目录里边。

sudo ./bootstrap生成构建系统文件。

发现报错如下:
-- Looking for connect in socket;
-- Looking for connect in socket; - not found
-- Looking for gethostname
-- Looking for gethostname - found
-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)
CMake Error at Utilities/cmcurl/CMakeLists.txt:587 (message):
Could not find OpenSSL. Install an OpenSSL development package or
configure CMake with -DCMAKE_USE_OPENSSL=OFF to build without OpenSSL.
-- Configuring incomplete, errors occurred!
---------------------------------------------
Error when bootstrapping CMake:
Problem while running initial CMake
---------------------------------------------

sudo apt-get install -y libssl-dev安装依赖包。

需要按一下回车键。

完成之后如下图:

重新执行sudo ./bootstrap。

完成之后如下图:

sudo make进行编译。

完成之后如下图:

sudo make install进行安装。

完成之后如下图:

sudo cmake --version显示出来cmake version 3.27.7就是安装完成。

此文章为11月Day 10学习笔记,内容来源于极客时间《网络编程实战》。



















