CentOS7上安装CMake教程

文章目录

    • 一、相关环境参数
      • 1. 操作系统
      • 2. CMake版本
    • 二、安装步骤
      • 1.解压
      • 2. 执行 ./bootstrap
        • 报错1:-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing......
        • 报错1——解决方案
        • 报错2:-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
        • 报错2——解决方案
        • 报错3:-- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)
        • 报错3——解决方案
      • 3. 执行 make
      • 4. 执行 make install
      • 5. 查看cmake版本

一、相关环境参数

1. 操作系统

[root@VM_0_11_centos proc]# cat /proc/version
Linux version 3.10.0-1062.9.1.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Fri Dec 6 15:49:49 UTC 2019

2. CMake版本

[root@VM_0_11_centos software]# ls
cmake-3.17.3.tar.gz

二、安装步骤

1.解压

[root@VM_0_11_centos software]# tar -zxvf cmake-3.17.3.tar.gz

2. 执行 ./bootstrap

[root@VM_0_11_centos cmake-3.17.3]# ./bootstrap

报错1:-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing…

-- 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:454 (message):
  Could not find OpenSSL.  Install an OpenSSL development package or
  configure CMake with -DCMAKE_USE_OPENSSL=OFF to build without OpenSSL.

报错1——解决方案

[root@VM_0_11_centos cmake-3.17.3]# ./bootstrap --system-curl

报错2:-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)

-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
CMake Error at CMakeLists.txt:425 (message):
  CMAKE_USE_SYSTEM_ZLIB is ON but a zlib is not found!
Call Stack (most recent call first):
  CMakeLists.txt:710 (CMAKE_BUILD_UTILITIES)

报错2——解决方案

下载、解压zlib-1.2.11.tar.gz

[root@VM_0_11_centos software]# tar -zxvf zlib-1.2.11.tar.gz
[root@VM_0_11_centos software]# cd zlib-1.2.11/
[root@VM_0_11_centos zlib-1.2.11]# ./configure
[root@VM_0_11_centos zlib-1.2.11]# make
[root@VM_0_11_centos zlib-1.2.11]# make check
[root@VM_0_11_centos zlib-1.2.11]# make install

报错3:-- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)

-- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)
CMake Error at CMakeLists.txt:442 (message):
  CMAKE_USE_SYSTEM_CURL is ON but a curl is not found!
Call Stack (most recent call first):
  CMakeLists.txt:710 (CMAKE_BUILD_UTILITIES)

报错3——解决方案

[root@VM_0_11_centos cmake-3.17.3]# yum install -y curl-devel

3. 执行 make

[root@VM_0_11_centos cmake-3.17.3]# make

4. 执行 make install

[root@VM_0_11_centos cmake-3.17.3]# make install

5. 查看cmake版本

[root@VM_0_11_centos cmake-3.17.3]# cmake -version
cmake version 3.17.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

你可能感兴趣的:(服务器运维)