Talk: Embracing Modern CMake

Because CMake is already over 15 years old, best practices have changed over time, in particular in the last 6 years. This talk will explore how to achieve some tasks using modern CMake idioms, as well as tooling and future directions.

C and C++ developers wishing to build code on multiple platforms will often rely on CMake to find dependencies and generate their build system.

The Internet is full of ways to write CMake code as it was common in 2006. However, CMake itself has moved on. A new set of APIs introduced in more-recent CMake versions aim for a conceptual consistency, simplicity and modularity in CMake code which was not previously possible.

CMake backward compatibility promises ensure that existing code continues to work, but as for C++, this form of ‘Modern CMake’ aims to simplify the developer experience, result in easier, more understandable and maintainable code, and establish future direction for how we use CMake.

This presentation will illustrate some differences and advantages between legacy approaches to CMake code and ‘Modern CMake’. After this presentation, the audience will be able to easily recognize legacy code and be able to make refactoring steps to improve the build system code.