【C++】CentOS环境搭建-升级CMAKE
- CMAKE报错CMake 3.12 or higher is required. You are running version 2.8.12.2
- 升级步骤
- 1.移除当前的cmake
- 2.安装必要的构建工具和库
- 3.下载最新的cmake源码并解压
- 5.编译和安装
- 6.验证安装
CMAKE报错CMake 3.12 or higher is required. You are running version 2.8.12.2
[root@localhost log4cplus-REL_2_0_8]# mkdir build && cd build
[root@localhost build]# cmake ..
-- The C compiler identification is GNU 9.3.1
-- The CXX compiler identification is GNU 9.3.1
-- Check for working C compiler: /opt/rh/devtoolset-9/root/usr/bin/cc
-- Check for working C compiler: /opt/rh/devtoolset-9/root/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /opt/rh/devtoolset-9/root/usr/bin/c++
-- Check for working CXX compiler: /opt/rh/devtoolset-9/root/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:15 (cmake_minimum_required):
CMake 3.12 or higher is required. You are running version 2.8.12.2
-- Configuring incomplete, errors occurred!
See also "/root/log4cplus-REL_2_0_8/build/CMakeFiles/CMakeOutput.log".
[root@localhost build]# make
make: *** No targets specified and no makefile found. Stop.
[root@localhost build]# sudo make install
make: *** No rule to make target `install'. Stop.
[root@localhost build]#
升级步骤
1.移除当前的cmake
sudo yum remove cmake
2.安装必要的构建工具和库
sudo yum groupinstall 'Development Tools'
sudo yum install freetype-devel
3.下载最新的cmake源码并解压
官网地址:https://cmake.org/
wget https://github.com/Kitware/CMake/releases/download/v3.29.3/cmake-3.29.3.tar.gz
tar -zxvf cmake-3.29.3.tar.gz
cd cmake-3.29.3
5.编译和安装
这里编译时间挺久的耐心等待
./bootstrap --prefix=/usr/local -- -DCMAKE_BUILD_TYPE:STRING=Release
make
sudo make install
export PATH=/usr/local/share/cmake-3.29/bin:$PATH
6.验证安装
cmake --version