CMake Training

This CMake training covers in depth how CMake works and how to efficiently write CMake scripts for small to larger projects. The second part of the training covers advanced usage of CMake, and notably packaging with CPack, continuous integration with CDash and download, configure and build automatically project dependencies with ExternalProject.

This CMake training mixes theory and application with a set of tutorials and exercises.

cmake training logo

Objectives

  1. Configure simple and complex projects with CMake
  2. Understand the basics of CMake (variables, cache, flow, etc.)
  3. Package full applications with CPack
  4. Learn about the target centric modern approach
  5. Export and Import your CMake projects
  6. Create SuperBuilds that download, configure, build and install project dependencies

Prerequisites

C/C++ : Basic knowledge

Day 1

  • Getting Started with CMake

    • CMake history

    • The advantages of CMake

    • CMake major features and pipeline configuration

  • Setup projects with CMake

    • CMake syntax: variables, cache usage, and workflow management

    • Starting a CMake project

    • Pass flags and definitions to the compiler

    • Extend CMake functionalities with functions, macros and helper files

    • Optimize builds with build configurations

    • Optimize Library management

  • CMake Modern Best Practices

    • How to convert legacy CMake to modern CMake

    • Best practices with the target-based approach

    • Fine tuning of target properties propagation via dependencies

    • Create build configuration specific settings with generator expressions

    • Understand the system introspection

    • Prepare packaging and target export by setting install rules

  • Writing unit tests with CTest

    • Presentation of the tool handling unit tests: CTest

    • Quickly and easily test applications and algorithms

    • Integration of CTest with other testing framework

    • Implement integration tests with fixtures

Day 2

  • Packaging with CPack

    • Introduction to the packaging tool: CPack (provided with CMake)

    • Quickly and efficiently package applications on multiple platforms: Windows, Mac, Linux (Debian installers and Yum)

  • System introspection

    • Understand what are FindModules and how to use them

    • Write FindModules to import non CMake-compatible projects

    • Understand how FindModules seek files in the host machine

    • Use try_compile and try_run features to get platform specific information from the host machine

  • CMake Presets

    • Setup the environment of CMake to configure, build, test and package your project

    • Automatically set environment variables or predefined CMake variables

  • Continuous Integration with CDash

    • Implement a continuous integration system prototype

    • Send unit tests to the CDash website

    • Maintains a global overview of the software quality

    • Unique CDash features: code coverage, memory analysis, client configuration

  • Advanced CMake

    • Use CMake to run arbitrary commands at specific times of the configuration or build process

    • Mixing library types

    • Symbol visibility handling in MVSC

    • Export and Import your CMake project (Config Modules)

    • Dealing with internal and external libraries

  • Extra chapters – Covered if time permits it and depending on participants’ interests

    • Speed up your compilations by integrating ccache

    • How to do cross-compilation with CMake

    • CMake policies

    • External Projects – Download, Patch, Configure, Build, Test and Install your dependencies automatically

    • Presentation of the Conan package manager

  • Conclusion

    • Tips to maintain good code quality and debug your CMake scripts

    • Quick look on CMake’s latest features

This training course will be taught in English. Course notes are also in English.
Participants are asked to bring a laptop computer for this training session.
The instructor will communicate all the specifications required to each participants before the training session.

Lunch is included.

Kitware SAS is registered as a training center in France

 

Practical Information

Duration: 2 days
Next training Date: March 4-5, 2024
Time zone: Paris (CET / GMT+1h)
Schedule: 9am to 5pm
Location: Online
Price: 1 500€

Company Training

All our training can be offered on site with a custom agenda. Contact us for more information.

About the instructor

Julien Jomier image

After obtaining his high school diploma, Alexy worked on personal projects for over two years.
As a passionate and dedicated programmer, Alexy managed to develop strong skills in C++.