Modern CMake for modular design

Speaker: Mathieu Ropert

Audience level: Intermediate

category

CMake is the build system chosen by most of the C++ open source projects. While it is fully capable of helping you enforce a good modular design, those features are usually not well known or understood.

In this talk I will present modern CMake practices that will simplify your project build and help you design better C++ components with clear dependencies and build interfaces (the sum of compile flags required to use a given library). We will first do a quick recap of the theory behind modular design, most of it coming from John Lakos' work on Large Scale C++ Software Development. Then we will see a few of the legacy CMake patterns that can be found in a lot of open source projects and explain their shortcomings. We will learn how to create a clean C++ library using modern CMake practices and depend on it in others modules. Finally, we will explore the options available to export the build interfaces for use by external projects.