CMake is easy to install in Ubuntu using apt:
$ sudo apt install cmake
However, depending on your version of Ubuntu, the CMake version that is installed might be very old. So, you might run into problems when you build projects that use features from more recent versions of CMake.
CMake provides binary versions for Linux x86_64. Installing the latest version of CMake from these packages is easy:
$ sudo apt remove cmake cmake-data
.sh binary package of the CMake version you want from here. When I downloaded, I got
Move the downloaded package to
/opt and execute it:
$ sudo mv cmake-3.14.0-Linux-x86_64.sh /opt $ cd /opt $ sudo chmod +x cmake-3.14.0-Linux-x86_64.sh $ sudo bash ./cmake-3.14.0-Linux-x86_64.sh
This installs this version of CMake in the directory
$ sudo ln -s /opt/cmake-3.14.0-Linux-x86_64.sh/bin/* /usr/local/bin
$ Test if CMake is working:
$ cmake --version cmake version 3.14.0 CMake suite maintained and supported by Kitware (kitware.com/cmake).
Tried with: Ubuntu 18.04