Professional CMake:

A Practical Guide

Structured learning, best practice and real world advice direct from a CMake co-maintainer

Production Focused

Professional CMake: A Practical Guide is the handbook for every CMake user, from beginner to seasoned veteran. It contains hundreds of pages of real-world advice, best practices and insights gained from production projects and interaction with the CMake community.

Topics cover the complete software pipeline, from the very initial setup of a project through to testing, packaging and integration with other projects. Important more advanced topics like improving build performance are also covered.

Flexible Learning

Each chapter focuses on a particular theme or fundamental concept. Read them in order as a structured CMake tutorial, or jump to specific chapters to focus on a particular topic or solve a specific problem. Every chapter ends with a Recommended Practices section highlighting the most important points.

Regular Updates

A new edition of the book is typically published sometime after each CMake feature release. Every purchase includes access to all future editions at no extra cost, so you can always stay up-to-date. The latest version of the book is the 13th Edition, which covers up to CMake 3.24.

Front cover for Professional CMake: A Practical Guide
The book is provided in digital form only (PDF and EPUB)



Buying on behalf of someone else? Want to bulk buy multiple copies with up to 76% discount? Purchase coupon codes instead…


Table Of Contents

Part I: Fundamentals

  1. Introduction
  2. Setting Up A Project
  3. A Minimal Project
  4. Building Simple Targets
  5. Variables
  6. Flow Control
  7. Using Subdirectories
  8. Functions And Macros
  9. Properties
  10. Generator Expressions
  11. Modules
  12. Policies
  13. Debugging And Diagnostics

Part II: Builds In Depth

  1. Build Type
  2. Compiler And Linker Essentials
  3. Advanced Linking
  4. Language Requirements
  5. Target Types
  6. Custom Tasks
  7. Working With Files
  8. Specifying Version Details
  9. Libraries
  10. Toolchains And Cross Compiling
  11. Apple Features

Part III: The Bigger Picture

  1. Finding Things
  2. Testing
  3. Installing
  4. Packaging
  5. ExternalProject
  6. FetchContent
  7. Making Projects Consumable
  8. Dependency Providers
  9. Presets
  10. Project Organization
  11. Build Performance
  12. Working With Qt


CMake is a very popular tool for defining how projects should be built, tested and packaged. Its maturity, breadth of features, broad platform support and toolchain flexibility have led to its widespread adoption among the software development community. In recent years, the 3.x release series has brought with it a whole new set of powerful capabilities and best practices, leading to the coining of the term Modern CMake. One of the key motivations for this book is to provide developers with an up-to-date, practical guide to learning CMake, paying particular attention to these more modern practices. As a CMake tutorial, it follows a logical sequence from basic concepts through to more advanced topics. For the more experienced user, the chapter structure allows the reader to quickly focus in on a particular area of interest.

Part I: Fundamentals

The first part of the book introduces each of the fundamental areas of CMake. These early chapters are arranged to get the reader up and running quickly with a basic project, then progressively build up an understanding of CMake’s core concepts in manageable, structured units. These chapters not only present the key concepts, they also shape the reader’s understanding of how CMake can be used most effectively and how to avoid common pitfalls.

Part II: Builds In Depth

The middle part of the book goes into much greater detail about various key areas and has a more task-focused flavor. Much of the material addresses everyday problems frequently faced by developers, while many of the chapters cover features that are new or improved in the 3.x release series. Some chapters go even deeper than discussing CMake alone and cover topics such as advanced linking techniques, how to structure libraries, managing versioning across platforms and an in-depth treatment of Apple-specific technologies such as bundles, frameworks and code signing. The many recommended practices in these chapters demonstrate how developers can get the most out of CMake’s extensive feature set. They also draw attention to a number of common but discouraged practices and explain why they should be avoided.

Part III: The Bigger Picture

The last part of the book expands the reader’s focus to extend beyond their own isolated project and to look at their project from different perspectives. Managing the complexities of inter-project dependencies is one of the more difficult tasks faced by developers, and these final chapters tackle this area head-on. The reader is taken through the various aspects of finding and providing dependencies, making a project consumable by others, how to robustly prepare packages in various formats and how to follow common platform conventions. A deep coverage of the available testing features is also included to enable developers to have greater confidence in the integrity of their project. The important topic of simplifying a developer’s workflow using CMake presets is discussed in its own dedicated chapter. One of the last few chapters is dedicated to project organization, bringing together much of the earlier material and demonstrating how to structure a CMake project to improve its maintainability and shorten the path for new developers joining the project. A chapter is also dedicated to the important topic of build performance, highlighting a variety of tools and techniques that can significantly reduce build times. Lastly, the final chapter covers the special area of Qt support. It includes discussion of features provided by both CMake and Qt, covering topics including moc, uic and rcc support, translation handling and using Qt’s deployment tools.

Frequently Asked Questions

Can I copy the book to read on my various devices?

Yes, you are free to make copies for your own personal use. The copyright message from the book states the following:

  • The original purchaser may make personal copies exclusively for their own use on their electronic devices, provided that all reasonable steps are taken to ensure that only the original purchaser has access to such copies.
  • Permission is given to use any of the code samples in this work without restriction. Attribution is not required.

Can I purchase a printed version?

The book is only available in electronic form at this time. Buyers are permitted to print their own personal copy if they so wish.

Is the book available from other places like Safari Books Online, Amazon, etc.?

The book may only be purchased directly from the Crascit website.

Is there any other freely available material by the same author?

This site contains a number of CMake blog articles by the same author. Some of the more popular ones include:

The author’s talk at CppCon 2019 also provides a taste of the sort of material the book covers.

I’ve lost my order details or download link. How can I recover them?

If you have misplaced your original order confirmation email with the download link, you can visit this link to have it resent to you. Note that you must use the same email address as the original order.