Difference between revisions of "Programming/Tools/CMake"

From Thalesians Wiki
Line 31: Line 31:
to it. We then create a directory for the project
to it. We then create a directory for the project
<pre>
<pre>
$ mkdir  
$ mkdir my_project
</pre>
</pre>

Revision as of 14:33, 22 December 2020

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 gccGNU 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

to it. We then create a directory for the project

$ mkdir my_project