【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