Programming/Tools/CMake
Overview
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. The suite of CMake tools were created by Kitware in response to the need for a powerful, cross-platform build environment for open-source projects such as ITK and VTK.
CMake is part of Kitware's collection of commercially supported open-source platforms for software development.
This tutorial
In this tutorial we demonstrate how to set up and build an (admittedly very simple) project using CMake on an Ubuntu 20.04.1 LTS system. The tutorial should be applicable to other Linux systems, possibly with minor modifications.
Preparation
First, we need to install CMake:
$ sudo apt update ... $ sudo apt install cmake
Since we'll be using CMake with gcc—GNU project C and C++ compiler,— we also need to install gcc:
$ sudo apt install gcc
Basic project
We'll start working from the home directory, so we
$ cd