CMake is a cross-platform tool for building, testing and packaging software.

If you've been writing C or C++ (or maybe Fortran) you probably had to, at some point, use cmake to package your software.

If you're a Linux user, you'd normally just need to run:

sudo apt-get install -y cmake

to install it. But sometimes, the version that you can install from the official repository is not the one you need.

Therefore, you will probably need to proceed with a manual installation. But before you do that, check the current version to see whether is the one you expect or not:

cmake --version

NOTE: These instructions should work for Debian based distros and macOS.

Remove the current install:

sudo apt-get -y purge --auto-remove cmake

Download the latest stable release, e.g v3.16.4 (do not download the binary/dmg distribution, but the Linux/Unix source):

wget https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4.tar.gz

Unzip the archive:

tar -xzvf cmake-3.16.4.tar.gz

Build and install it:

cd cmake-3.16.4
./bootstrap
make -j$(nproc)
sudo make install

Verify the installation:

cmake --version

If you see something like:

cmake version 3.16.4
CMake suite maintained and supported by Kitware (kitware.com/cmake).

you're good to go.

For other platforms, check the official install guide.