Skip to content

Intro to Cmake

Overview

CMake is an open-source build system introduced by developers & engineers at Kitware in 2000 as a part of the Visible Human Project managed by the National Library of Medicine (NLM). CMake is typically used for C and C++ projects. Naturally, this also includes embedded software/systems projects.

What makes CMake interesting is that it instead of just configuring the compiler option it produces the configuration for tools like make and ninja which then can use that template to produce the desired artifacts. In essence it sits a level above typical build systems which is why many developers refer to CMake as a meta build system.

Single source builds on multiple platforms

CMake: The Standard Build System - Features

Why CMake

We noted that there are multiple options for build systems so why consider CMake? This is not a complete list but here are a few features that we've come to appreciate during out time with the tool:

  1. Cross-platofrm - CMake is usable on Windows, Mac OS, and most Linux distributions
  2. Extensible - It's extremely easy to integrate tooling such as Doxygen with your build process through CMake
  3. Software like syntax - Unlike makefiles, CMake and other higher level build systems have more conventional constructs similar to many (imperatvive) programming languages
  4. Consistency - Getting reproducible and consistent builds between developers and students has been easier after integrating a build system
  5. Testing integration - CMake tends to play well with unit/module tests with through it's testing tool CTest

We shall build on these principles & features more in the following guides but lets get our development environment setup first.