How to Install CMake on Debian 12

CMake is a software utility that is used for the development of applications. It is also used to test the application without the restriction of the compiler. Primarily, it is designed to build applications written in the C and C++ programming languages. Later on, it is also supported by other programming languages including Rust and Java. 

Some of the important features of the CMake are:

  • It can be used to develop complicated software from single input files, moreover, these softwares are compatible with multiple platforms including Android and IOS.
  • Fortran and C++ modules are supported by the CMake
  • Using the CMake, users can have multiple build trees from the single source tree
  • The CPak is included in the CMake because installers for various platforms including Windows, Linux, and MacOS are included.
  • It also supports the configuration header files for a build

After these features, users must be curious to install it on the Latest Debian 12. This blog will demonstrate the CMake’s installation by various methods following the next mentioned outline: 

  1. What are the Ways for Installing CMake on Debian
  2. Method 1: Install CMake on Debian Using the Snap Package
  3. Method 2: Install CMake on Debian Using the GitHub
  4. Method 3: Install CMake on Debian Using Software
  5. How to Uninstall CMake on Debian

Let’s explore the multiple installation methods for CMake on Debian Linux. 

What are the Ways for Installing CMake on Debian?

There are three different installation methods of CMake on Debian including the snap package, Software application, and GitHub. All these methods are explained with the complete step-by-step guide. 

Method 1: Install CMake on Debian Using the Snap Package

The first and easiest installation method of CMake on Debian is by downloading and installing its snap from the Snapcraft. Users who are familiar with the snap packages and their usage are recommended to go through the following blog

To install the CMake on Debian 12 using its snap package, run the following command in the terminal:

$ sudo snap install cmake --classic

To verify the installation of CMake using the above command, display its installed version:

$ cmake --version

This shows the successful installation of the CMake on Debian 12. 

Method 2: Install CMake on Debian Using the GitHub

Another method for installing the CMake on Debian 12 is by using the GitHub package by the below-mentioned steps. 

Step 1: Update the Packages

First, it is suggested to update all the packages to ensure that the updated versions of the packages are being installed by using the command:

$ sudo apt update

Step 2: Install the Dependencies of CMake

Most of the time the dependencies of the CMake are pre-installed on Debian 12. It is better to make sure the installation of the dependencies by running the command:

$ sudo apt install build-essential libssl-dev -y

Step 3: Download the Source Code of CMake

Now using the wget command utility, download the “Source code” of the CMake from the official page of the CMake:

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

Step 4: Extract the Downloaded tar File of CMake

When the downloading is completed, extract the downloaded package of the “CMake” using the command:

$ tar -zxvf cmake-3.28.1.tar.gz

Step 5: Navigate to Extracted CMake

After the extraction of the CMake, navigate to it by running the command:

$ cd cmake-3.28.1

Step 6: Run the bootstrap Script

Compile the package of the CMake by using the bootstrap script:

$ sudo ./bootstrap

Step 7: Build the CMake Package

When the compilation of the CMake package is completed, then build its package by running the command:

$ sudo make

Step 8: Install Make

Finally, install the CMake using the command:

$ sudo make install

Verify the installation by displaying its version with the execution of the command:

$ cmake --version

CMake package has been installed successfully on Debian from its source code with the above-mentioned steps. 

Method 3: Install CMake on Debian 12 Using Software

First, open the “Software” from the GNOME application’s menu:

Now search for the “cmake” by typing its name in explore section:

Click on the “Install” to initialize the installation of the cmake:

Enter the sudo password if you are not a root user and then click on the “Authenticate” button:

The application has started to be installed as can be seen in the figure:

The application of cmake has been installed click on the “Open” button to launch it:

The application has been launched successfully:

How to Uninstall CMake on Debian 12?

Run the below-mentioned command to remove the CMake on Debian 12 if it is installed using the snap command:

$ sudo snap remove cmake

If it is installed using the “Software” then find the cmake and click on the delete icon as shown:

Command ‘cmake’ not found

If the error of the “Command ‘cmake’ not found” is displayed on the screen then fix it by following the instructions explained in this post.

These are different ways to install and remove CMake on Debian using the terminal. 

Conclusion

To install the CMake on Debian 12, use the snap package by running the “sudo snap install cmake –classic” command in the terminal. Another approach to install the latest version of the CMake on Debian 12 is by using its source code from GitHub. The GitHub link for the source code is also available in the “Downloads” section of CMake’s official website. 

All the installation methods of the CMake are explained with the complete step-by-step guide in this post.