Compiling CMake

Author

Felipe Carlos

Published

December 28, 2024

Compiling CMake from source is a straightforward process that ensures you can use a specific version tailored to your requirements.

This document shows the commands I use to compile CMake in my Ubuntu environments.

1. Update package list

Start by updating the package list to ensure you have the latest versions of necessary tools and libraries:

sudo apt update -y

2. Install required dependencies

Install the required tools and libraries for compiling CMake:

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

3. Download the CMake source code

Download the source code for the desired CMake version (e.g., CMake 3.19.8):

wget https://github.com/Kitware/CMake/releases/download/v3.19.8/cmake-3.19.8.tar.gz

Next, extract the downloaded file and navigate to the resulting directory:

tar -zxvf cmake-3.19.8.tar.gz
cd cmake-3.19.8

4. Configure the build

Use the boostrap script to configure the build:

./bootstrap

5. Compile CMake

Build the source code using the make command:

make

This step may take some time depending on your system.

6. Install CMake

Install the compiled binaries system-wide:

sudo make install

7. Verify the installation

Now, confirm that the installation was successful and check the installed version of CMake:

cmake --version