• CentOS 7 安装CMake指定版本3.21.2


    背景:今天在CentOS 7 电脑上安装C++ 日志框架SpdLog-1.12.0,提示如下错误信息:

    1. [root@localhost build]# cmake .. && make -j
    2. CMake Error at CMakeLists.txt:3 (cmake_minimum_required):
    3. CMake 3.10...3.21 or higher is required. You are running version 2.8.12.2
    4. -- Configuring incomplete, errors occurred!

    结论:SpdLog 日志框架要求编译的Cmake版本最低3.10 或3.21,我现在运行的版本仅为2.8.12.2 版本。

    CentOS 7 安装CMake-3.21.2版本

    第一步:下载CMake 源码

    官网地址:https://github.com/Kitware/CMake

    选择tags,下载自己所需的目标版本。

    CentOS 7 安装CMake 指令

    1. # 移除本地cmake
    2. [root@localhost build]# yum remove cmake
    3. 已加载插件:fastestmirror
    4. 正在解决依赖关系
    5. --> 正在检查事务
    6. ---> 软件包 cmake.x86_64.0.2.8.12.2-2.el7 将被 删除
    7. --> 解决依赖关系完成
    8. 依赖关系解决
    9. ================================================================================================================================================
    10. Package 架构 版本 源 大小
    11. ================================================================================================================================================
    12. 正在删除:
    13. cmake x86_64 2.8.12.2-2.el7 @base 27 M
    14. 事务概要
    15. ================================================================================================================================================
    16. 移除 1 软件包
    17. 安装大小:27 M
    18. 是否继续?[y/N]:y
    19. Downloading packages:
    20. Running transaction check
    21. Running transaction test
    22. Transaction test succeeded
    23. Running transaction
    24. 正在删除 : cmake-2.8.12.2-2.el7.x86_64 1/1
    25. 验证中 : cmake-2.8.12.2-2.el7.x86_64 1/1
    26. 删除:
    27. cmake.x86_64 0:2.8.12.2-2.el7
    28. 完毕!
    29. [root@localhost build]# cd ..
    30. [root@localhost spdlog-1.12.0]# cd ..
    31. [root@localhost source_code]# ll
    32. # 解压上传的cmake
    33. [root@localhost source_code]# tar -zxvf CMake-3.21.2.tar.gz
    34. CMake-3.21.2/
    35. CMake-3.21.2/.clang-format
    36. CMake-3.21.2/.clang-tidy
    37. CMake-3.21.2/Auxiliary/
    38. CMake-3.21.2/Auxiliary/CMakeLists.txt
    39. *****
    40. # 项目编译
    41. [root@localhost CMake-3.21.2]# ./bootstrap
    42. ---------------------------------------------
    43. CMake 3.21.2, Copyright 2000-2021 Kitware, Inc. and Contributors
    44. Found GNU toolchain
    45. C compiler on this system is: gcc
    46. C++ compiler on this system is: g++ -std=gnu++1y
    47. Makefile processor on this system is: gmake
    48. g++ has setenv
    49. g++ has unsetenv
    50. g++ does not have environ in stdlib.h
    51. g++ has stl wstring
    52. g++ has <ext/stdio_filebuf.h>
    53. ******
    54. CMake has bootstrapped. Now run gmake.
    55. # 项目本地安装
    56. [root@localhost CMake-3.21.2]# make && make install
    57. [ 0%] Building C object Source/kwsys/CMakeFiles/cmsys.dir/ProcessUNIX.c.o
    58. [ 0%] Building C object Source/kwsys/CMakeFiles/cmsys.dir/Base64.c.o
    59. [ 0%] Building C object Source/kwsys/CMakeFiles/cmsys.dir/EncodingC.c.o
    60. [ 0%] Building C object Source/kwsys/CMakeFiles/cmsys.dir/MD5.c.o
    61. [ 0%] Building C object Source/kwsys/CMakeFiles/cmsys.dir/Terminal.c.o
    62. [ 0%] Building C object Source/kwsys/CMakeFiles/cmsys.dir/System.c.o
    63. ******
    64. # 验证本机cmkae 版本信息
    65. [root@localhost CMake-3.21.2]# cmake -version
    66. cmake version 3.21.2
    67. CMake suite maintained and supported by Kitware (kitware.com/cmake).

     

  • 相关阅读:
    Go语言中的逃逸分析
    【微信小程序】实现投票功能(附源码)
    如何使用Python进行机器学习?
    史上最短苹果发布会;三星、LG、高通联手进军 XR 市场丨 RTE 开发者日报 Vol.74
    面试:自定义view / viewgroup 相关问题
    echarts折线图每段显示不同的颜色
    乔哥的系统
    数据结构(四)--队列及面试常考的算法
    k8s etcd 简介
    django rest framework 学习笔记-实战商城2
  • 原文地址:https://blog.csdn.net/zhouzhiwengang/article/details/134491816