CMake is a tool to build, test and package software independently from an operating system.

New CMake users are advised to follow the “An Introduction to Modern CMake” tutorial, CMake 2.x users may be interested in “It’s Time To Do CMake Right” (see references below).

The underlying concepts used in our cmake implementation can be found here.

Modern CMake

Modern CMake promotes, among others, following concepts:

  • Use CONFIG mode to load dependency settings to the project, if not available Find<package>.cmake recipe should provide imported target
  • Use targets and properties, avoid operations on directories and global variables
    • Use target property scopes: PRIVATE and INTERFACE
    • Instead of setting a global variable use target specific functions: target_compile_options, target_compile_features or target_compile_definitions
  • Generator expressions should be used to replace simple if/else statements
  • Export your targets by creating CMake config


  1. An Introduction to Modern CMake
  2. It’s Time To Do CMake Right
  3. O2 CMake