Hello, friends. In this post, you will learn how to install CMake on Rocky Linux 9 / CentOS 9 Stream. Let’s get started.
Introduction—What is CMake?
CMake is a cross-platform code generation or automation tool. It allows developers to write a platform-independent CMakeList.txt file to customize the whole compilation process and then generate the necessary localized Makefile files.
A more precise definition is given by the CMake website:
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.
So, it’s always good to have it at your disposal, and even more so if you are a developer.
Install CMake on Rocky Linux 9 / CentOS 9 Stream
Before we start, we need to update the system completely.
sudo dnf update
Next, you have to enable EPEL repository, For this I recommend you to click on the link, and you can do it without problems.
Thereafter, install the packages needed to make the post
sudo dnf install gcc gcc-c++ openssl-devel bzip2-devel libffi-devel zlib-devel make tar
The next step is to download the latest stable version of CMake from the website or using wget
.
wget https://github.com/Kitware/CMake/releases/download/v3.23.2/cmake-3.23.2.tar.gz
Now unzip the file we have downloaded
tar -zxvf cmake-3.23.2.tar.gz
And then, access the folder that has been generated
cd cmake-3.23.2
Now configure the code with the following command
sudo ./bootstrap
If all goes well, you will see an output on screen
-- Configuring done
-- Generating done
-- Build files have been written to: /home/angelo/cmake-3.23.2
---------------------------------------------
CMake has bootstrapped. Now run gmake.
Now compile it
sudo make
And install it
sudo make install
If all the process has been successful, then you can check the version
cmake --version
Output:
So, we are ready.
Conclusion
In this post, you learned how to install CMake on Rocky Linux 9 / CentOS 9 Stream in a quick and easy process. Therefore, I hope you liked this post.