Introduction
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 availableFind<package>.cmake
recipe should provide imported target - Use targets and properties, avoid operations on directories and global variables
- Use target property scopes:
PRIVATE
andINTERFACE
- Instead of setting a global variable use target specific functions:
target_compile_options
,target_compile_features
ortarget_compile_definitions
- Use target property scopes:
- Generator expressions should be used to replace simple
if
/else
statements - Export your targets by creating CMake config