Get FREE domain for 1st year and build your brand new site
In this article, we have explained how to build and install Cmake in any system with OS Linux, Ubuntu and Windows.
Table of contents:
- Introduction to Cmake
- Get Cmake binary
- Build and install Cmake
- Check Cmake installation
Introduction to Cmake
Cmake is an open-source system that is used to manage the build process of production systems. It is frequently used to build and install other critical softwares like Clang.
The configuration of the system is saved in CMakeLists.txt file of Cmake which is used to prepare the build files for make tool.
Get CMake binary
- Download CMake binary depending on your system from this official download page
For Linux systems, you need to download the file cmake-3.22.3.tar.gz. The command to download it will be:
For Windows system, you need to download "cmake-3.22.3.zip" and for MacOS, you need to download "cmake-3.22.3-macos10.10-universal.tar.gz".
To download the latest source code, use the following command:
git clone https://github.com/Kitware/CMake.git
Go into the directory of Cmake source code:
Build and install Cmake
- Use the following command after extracting the download file:
./bootstrap make -j 16 sudo make install
If your system does not have "make", you can install it using the following command:
sudo apt-get install build-essential
sudo apt-get -y install make
Alternatively, you can use the following commands to build and install Cmake:
mkdir cmake-build && cd cmake-build ../cmake-source/bootstrap && make
Check Cmake installation
To check Cmake installation, we can check the version:
If it returns the correct value, you have successfully install Cmake in your system. Enjoy.