The tutorial for upgrading CMake on Ubuntu 18.04 is as follows:
-
Update package index:
-
Open a terminal and execute the following command to update the package index:
sudo apt update
-
-
Remove old version of CMake:
-
Run the following command in a terminal to uninstall older versions of CMake:
sudo apt remove cmake
-
-
Download the latest version of CMake:
- Find the latest version of CMake on the official CMake website ( Download | CMake ) and choose the Linux binary distribution suitable for your system.
- Copy the download link.
-
Download and install the latest version of CMake:
-
Run the following command in Terminal, replacing the download link with the actual link:
wget <下载链接>
-
Unzip the downloaded file, for example:
tar -zxvf cmake-<版本号>.tar.gz
-
Enter the decompressed directory:
cd cmake-<版本号>
-
Run the following commands to configure and compile CMake:
./bootstrap make -j4 # 使用-j参数以加快编译速度,数字4表示同时使用4个核心 sudo make install
-
-
Verify installation:
-
Verify that the installation of CMake was successful by running the following command:
cmake --version
- If you can see the version information of CMake, it means the installation is successful.
-
Through the above steps, you can successfully upgrade to the latest version of CMake on Ubuntu 18.04. Please make sure that the downloaded CMake version matches your system architecture and requirements. Hope this information helps you!