Install The Latest CMake Version in Ubuntu 18.04 (Bionic Beaver)

June 5, 2021 by Milicen

An easy way to install the latest version of CMake in Ubuntu 18.04 (Bionic Beaver)

  • linux

Here's a quick guide on how to get the latest CMake version in Ubuntu 18.04 LTS (Bionic Beaver).

What is CMake?

CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice. The suite of CMake tools were created by Kitware in response to the need for a powerful, cross-platform build environment for open-source projects such as ITK and VTK.

Some notable applications that uses CMake includes Netflix, ReactOS, KDE, Blender (3D modelling software), MySQL, and many more.

Install the latest version of CMake in Ubuntu 18.04

Ubuntu 18.04 ships with CMake v3.10.2. But for some type of applications, you need to have a later version of CMake to build. Using apt to install the latest CMake won't work. And so we use a workaround by downloading it from the official website.

Here are the steps to install :

Firstly, download the files of the required version of the corresponding system in cmake official by typing the line below into your terminal.

wget https://cmake.org/files/v3.16/cmake-3.16.7-Linux-x86_64.tar.gz  

Unzip the files using tar command.

tar zxvf cmake-3.16.7-Linux-x86_64.tar.gz

View unzipped files

tree -L 2 cmake-3.16.7-Linux-x86_64

If you get an error saying there's no tree command, install it by using the following line

sudo apt install tree

Create soft link

sudo mv cmake-3.16.7-Linux-x86_64     /opt/cmake-3.16.7  
sudo ln -sf  /opt/cmake-3.16.7/bin/*    /usr/bin/

Execute the following command to check the installed version

cmake --version

You should get CMake v3.16.7 if you're following along. You can check the latest version on the official website.

Wraping up

With just these simple steps, you will have the latest version of CMake in your system in just a few minutes.