1.下載cmake源碼
https://cmake.org/download/
選擇版本
2.文件目錄-解壓-進入文件夾-運行配置文件
tar -xvf cmake-3.15.2-Linux-x86_64.tar.gz cd cmake-3.15.2 ./configure // 執行配置, 片刻 make
// 編譯需要一些時間
sudo make install
// 完成安裝,此處需要root權限
3. 更改環境變量,改善適配
vim /etc/profile
末尾增加:
PATH=/usr/local/cmake/bin:$PATH
export PATH
使其生效:
source /etc/profile
查看安裝狀態
cmake -version
完成.