How to install CMake on Ubuntu

In this post, we show you how to install CMake on Ubuntu by GUI and command-line ways. Our Ubuntu release of choice in this tutorial is Ubuntu 18.04 LTS.

CMake is a cross-platform free and open-source software tool designed to build, test, and package the software. CMake uses a simple platform and compiler-independent configuration files to control the software compilation process. It leads to the production of native makefiles and workspaces, which are, in turn, used in a compiler environment of choice.

In this post, we are going to show you how to install CMake on your Ubuntu system. Our Ubuntu release of choice in this tutorial is Ubuntu 18.04 LTS.

Installing CMake on Ubuntu

Prerequisites

Before installing CMake, ensure you have root privileges and that your system is up to date by running the commands below.

sudo apt update
sudo apt upgrade

Method 1: Install CMake using Ubuntu Software

If you don’t want to go about executing a bunch of commands on the Linux Terminal, then this method is for you. As of writing this post, the available stable version of CMake is 3.17.3.

Step 1. Launch the “Ubuntu Software Install” from the Ubuntu applications menu, as shown in the image below.

Launch Software Install from Ubuntu Applications
Launch Software Install from Ubuntu Applications

Step 2. On the Ubuntu Software “Search Bar” at the top, type the word CMake and press “Enter.” You will see a list of applications but only Click on the CMake icon. It will probably be the first item on the list, as shown in the image below.

Search for CMake in the Search Bar
Search for CMake in the Search Bar

Step 3. Click on the “Install” button to download and install CMake on your Ubuntu system. You might be required to enter your root password to continue with the installation.

Click on the Install button to install CMake in your system
Click on the Install button to install CMake in your system.

Step 4. You can track the installation progress using the percentage below, as shown in the image.

See the Installation progress on the Percentage bar
See the Installation progress on the Percentage bar.

CMake will now install in your system. If the process completes successfully, You should see a window similar to the one on the image below.

Launch CMake after a successful installation
Launch CMake after a successful installation

Step 5. To start CMake, click on the “Launch” button. The CMake window should open, as shown in the image below.

Launch CMake
Launch CMake

Uninstall CMake using the Ubuntu Software

If you wish to remove CMake from your system using the Graphical User Interface GUI), it is pretty straightforward.

Step 1. Launch the Ubuntu Software application and search for “CMake” on the search bar above.
Step 2. Click on the CMake application that appears on the list. You should see a window similar to the one below.

Launch CMake after a successful installation
Remove/Uninstall CMake.

Step 3. Click on the “Remove” button to uninstall CMake from your Ubuntu system.

Removing CMake on Ubuntu
Removing CMake on Ubuntu

From the image below, we can see “CMake” is uninstalling from your system.

Method 2: Installing CMake using command-line

This is the method to follow to install CMake in your Ubuntu system to those who prefer the Command-line method over the Graphical User Interface. There are two ways which you can use to install CMake on your system via the Terminal:

a) Using snap

b) Using the source code from the official CMake website

Snap app

Step 1. Launch the Ubuntu Terminal and execute the command below.

sudo snap install cmake -classic

Once the installation completes, run the “–version” command below to see the CMake version installed in your system.

cmake --version

Install CMake via snap
Install CMake via snap

To Remove/Uninstall CMake using snap in the command-line, run the command below.

sudo snap remove cmake

Note, this method only works for CMake installed via Snap or Graphical way using the Ubuntu Software.

Remove CMake using Snap
Remove CMake using Snap

Installing CMake using Source Code VI

Before writing this post, I tried installing CMake from the Ubuntu repository and PPA, but none of them installed the latest CMake version. To install the latest CMake version, follow the steps below.

Step 1. Download the CMake source code from its official website. That can be done using the “wget” command on the Terminal, as shown below. Make sure to replace the link in the below command with the link you copy from the official website.

$ wget https://github.com/Kitware/CMake/releases/download/v3.17.3/cmake-3.17.3.tar.gz

Download Source code using wget
Download Source code using wget

Step 2. Navigate to the directory where you downloaded the code. It should be the folder in which you run the “wget” command. Run the “tar” command to extract the contents.

tar -zxvf cmake-3.17.3.tar.gz

Extract the source code using tar command
Extract the source code using tar command

Step 3. Navigate to the newly created CMake directory using the “cd” command.

cd cmake-3.17.3

Navigate to CMake directory
Navigate to CMake directory

Step 4. Run the command below to compile and install CMake in your Ubuntu system.

sudo ./bootsrap

Configure and Install CMake
Configure and Install CMake

Once the process completes, you should see a message, as in the image below.

CMake bootstrapped succesfully
CMake bootstrapped successfully

Step 5. Run the “make” command.

make

Run the make command
Run the make command

Step 6. Run the “make install” command to install CMake in your system.

make install

Make Install command
Make Install command

Step 7. To confirm that CMake installed successfully in your system, run the “version” command.

cmake --version

CMake version
CMake version

To Remove/Uninstall CMake installed using the “make” command, run the command below.

sudo make uninstall

Make Uninstall command
Make Uninstall command

Conclusion

Those are two ways to install CMake on your Ubuntu system. If you are new to using CMake and would like to know more about it, head over to the official site to read their comprehensive documentation.

Arun Kumar
Arun did his bachelor in computer engineering and loves enjoying his spare time writing for FOSS Linux. He uses Fedora as the daily driver and loves tinkering with interesting distros on VirtualBox. He works during the day and reads anything tech at night. Apart from blogging, he loves swimming and playing tennis.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

STAY CONNECTED

23,538FansLike
365FollowersFollow
16SubscribersSubscribe

LATEST ARTICLES

How to install CouchPotato on Ubuntu

Downloading movies and copying them over to your home server can get frustrating, especially if you are doing it daily! What if you have an option to download videos automatically, quickly, and above all with excellent quality. CouchPotato allows you to download movies easily once they are available and released automatically.

Top 20 Rsync Examples in Linux

The Rsync (remote sync) command is a Linux/Unix utility used to synchronize and copy files and directories either locally or remotely. Most Linux geeks use Rsync to mirror, backup or migrate data across folders, across disks and networks. One notable feature with the Rsync command is that it uses the "delta transfer algorithm."

Setting up NFS Server on Ubuntu Server

We have put together a detailed step-by-step tutorial that will guide you on how to install and set up NFS Server on Ubuntu so you too can start sharing data with other client systems. It is divided into sections, the first part discussing how to set up the host server and the second part showing you how to set up the client-side. For this tutorial, we will be using Ubuntu 20.04 LTS.

Crontab in Linux Explained With Examples

Crontab is the Linux equivalent of the Window's Task Scheduler. It can help you set up a task to run automatically at a regular...

The 10 Best Linux Server Distros For Home And Businesses

By the year 2020, it is estimated that there are close to 600 Linux distributions in the market. It includes both servers and Desktop versions; therefore, if you are looking for lightweight Linux distribution for your old PC or a reliable desktop version for employees in your organization, you may be overwhelmed with the number of choices for finding one for your use.

How to list the installed Packages on Ubuntu

It is only natural to start installing more and more software on your Ubuntu PC once you start using it. Similarly, it is also natural to lose track of the different packages that you have installed on your system. Eventually, you may be overwhelmed with the number of packages in your system and with the ones you hardly used.

MUST READ

Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.
Elementary OS 5.1 Hera has received a point release with a handful of new features and bug fixes, and we will be reviewing the significant changes in this article. For those new to elementary OS, this Ubuntu-based Linux distribution uses their inhouse built Pantheon desktop environment and AppCenter.

How to create a Live Linux USB drive using Etcher

In the Linux community, one thing is common between almost all of the users: trying out different Linux distributions. Most of the Linux based distributions have a great way of being tested as they provide ISO images for creating a Live USB.

Enabling GameMode on Linux for best gaming performance

GameMode is a combination of various libraries and daemons that allows all the users to improve the gaming performance on the Linux system. Developed by games publisher Feral Interactive, it improves gaming performance by requesting a group of options that will be applied temporarily to the Linux system.

What is the difference between Linux and Unix?

When discussing Linux and Unix with average users, it's not uncommon that they will sometimes mistakenly interchange the terms Linux and Unix.  The two are not the same.  Though they share similarities in their overall structures and toolkits, they are decidedly not the same.

6 ways to find out your Linux file system type

Any Operating system in the market whether its Windows, Linux, Unix, macOS, and any other, must be able to access and manage files and data on storage devices.