Things I Learnt While Trying to Avoid Becoming a CMake Expert

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.

Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED

By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED

Settings can be changed at any time from the Cookie Policy page.