Ubuntu 20.04.4 LTS allows cmake to be installed as follows using -y to suppress the prompt:
sudo apt-get update && sudo apt-get install -y cmake
The cmake installed is not the latest version as can be seen using cmake --version:
To install the latest version of cmake, first uninstall cmake (if it is already installed and that it was installed using apt-get):
sudo apt-get remove -y cmake
Latest cmake Install
The cmake releases can be found at:
https://github.com/Kitware/CMake/releases
The following script downloads and installs a specific version of cmake (version 3.24.1):
wget https://github.com/Kitware/CMake/releases/download/v3.24.1/cmake-3.24.1-Linux-x86_64.sh \
-q -O /tmp/cmake-install.sh \
&& chmod u+x /tmp/cmake-install.sh \
&& sudo mkdir /opt/cmake-3.24.1 \
&& sudo /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-3.24.1 \
&& rm /tmp/cmake-install.sh \
&& sudo ln -s /opt/cmake-3.24.1/bin/* /usr/local/bin
To verify the correct version of cmake is installed invoke cmake --version:
cmake Uninstall
Obviously "sudo apt-get remove -y cmake" cannot be used to uninstall cmake installed via cmake-install.sh.
The following steps uninstall cmake, be versing the steps used to install cmake above which used cmake-install.sh to install cmake:
pushd . \
&& cd /usr/local/bin \
&& ls /opt/cmake-3.24.1/bin | \
sudo xargs rm \
&& sudo rm -rf /opt/cmake-3.24.1 \
&& popd
No comments :
Post a Comment