How to Install CMake on Debian 10/11

  • Post last modified:August 4, 2021
  • Reading time:3 mins read

I’m trying to Build & Install the application from the source while an installation error occurs CMake: command is not found; due to that, I cannot install OBS-Studio.

Tell me how to resolve this error. Before that, you should know what CMake is? And why we are required during Installation or building package.

CMake is a cross-platform open-source tool to build packages using CMakeLists to generate builds for a specific environment. It was created by Bill Hoffman at Kitware and support multiple native build environments.

Prerequisite

All the essential requirement is already available to major Linux Distribution, and you just need to be part of sudoers groups. That’s all somewhere down you get any kind of error, please let me know in the comment section or approach your closest search engine.

To avoid any conflict, you can pass the following command to install any missing packages.

$ sudo apt install build-essential gcc libssl-dev

Steps to Install CMAKE on Debian 10/11

Currently, I’m installing CMake on my Debian 11 (bullseye), and I believe this works flawlessly on Debian 10 or Ubuntu 20.04 or any Other Linux Distrubtions. One can install CMake using a snap or from source. As usual, I prefer to install package from the source.

Step 1. Download CMAKE

To follow the upcoming steps, you need to download the CMake package, which you can get from the official web page. At the time of writing of this latest version is 3.21.0. For the latest version, make sure to refer CMAKE official page.

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

cmake-3.21.0.tar.gz 100%[================>]   9.17M  2.33MB/s    in 3.7s    

2021-07-20 23:05:37 (2.49 MB/s) - ‘cmake-3.21.0.tar.gz’ saved [9617926/9617926]

FINISHED --2021-07-20 23:05:37--
Total wall clock time: 5.9s
Downloaded: 1 files, 9.2M in 3.7s (2.49 MB/s)

For the sake of simplicity, you are free to download CMake from the Debian repository, but there is a catch, Not at all, you will get the latest version.

Step 2. Extract and run Bootstrap

Once the file gets downloaded, extract it using the tar command and change your current path to extracted directory:

$ tar xvf cmake-3.21.0.tar.gz
$ cd cmake-3.21.0 

Now run a bootstrap file from a terminal bypassing the below command and wait for a while to complete the process:

$ ./bootstrap 

I hope you can complete the above steps without any error. Under my circumstance, error pops out with the following message “Could not find OpenSSL. Install an OpenSSL development package or configure CMake with -DCMAKE_USE_OPENSSL=OFF to build without OpenSSL”.

To move ahead, I need to suppress this error for that simply pass the below command and wait for completion:

$ ./bootstrap -- -DCMAKE_USE_OPENSSL=OFF

Step 3. Install cmake

After bootstrapped, install the CMake.

$ gmake
$ sudo make install

Check cmake version

Once you complete the above step, pass the version command to ensure Installation has been accomplished as per our intend:

$ cmake --version

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

Wrapping-up

That’s all to Install cmake on Debian or any Debian based system, after that you can easily build application on you system.

Read :- Building Programs from Source on any Linux Distribution in a simple way

If you want to share something about the head command that I missed or know something that would help others, please share that in a comment section.

If you want to say Hi to me or want to suggest something feel free to contact me.

Like what you read? Please share it with others.
  • 1
    Share

Leave a Reply