Home » Linux Host, Ubuntu, SysAdmin » Commands and Packages » How to install the latest cmake version on Ubuntu ?

How to install the latest cmake version on Ubuntu ?

If you are trying to compile some opensource software which using cmake for the compilation, some of the .cmake file used by that opensource code might contains the requirement check for version as,

cmake_minimum_required(VERSION 3.11)

Due to this version check, if your default Ubuntu installed cmake version is less than 3.11, [ As in our case, on Ubuntu 18.04, default cmake version is 3.10.2 ], you will see an error like as below,

CMake Error at CMakeLists.txt:25 (cmake_minimum_required):
  CMake 3.11 or higher is required.  You are running version 3.10.2

To solve this dependency check, we will need to upgrade the cmake version to latest, which can be done on Ubuntu 18.04 as below,

Remove current cmake as,

$ sudo apt remove cmake

Make sure you have “pip” installed, if not, install as mentioned in “How to Install Pip on Ubuntu”

Now, install cmake as,

$ sudo pip install cmake --upgrade

Check the version of pip as,

$ which cmake
/usr/local/bin/cmake
$ cmake --version
cmake version 3.13.3

Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment