By CB Bailey
I am absolutely not a CMake expert, but over the course of the past two years I have acquired the maintainership of a few of the most popular CMake modules at my employer.
During that time I have encountered a variety of patterns, practices and pitfalls, and I’d like to share what I’ve found works and things which I’ve learnt to avoid.
I’ll start with a brief demonstration of CMake, using a simple project to explain fundamentals and some basic best practices.
I’ll then examine some of the drivers that might lead one to seek more powerful constructs and use this as an opportunity to investigate variables, functions and macros. In this section, I’ll go quite carefully over a few of the more surprising behaviours of the CMake language.
Finally, I’ll demonstrate how to put some of the more powerful features together to build some sophisticated configure-time functionality.