Professional CMake: A Practical Guide is the handbook for every CMake user, from beginner to seasoned veteran. With 480 pages of real-world advice presented in a logical, structured format, it progressively teaches how to make the most of the CMake family of tools. Packed with the latest best practices, topics cover the complete software pipeline, from the very initial setup of a project through to testing, packaging and integration with other projects. Use the book as a step-by-step CMake tutorial or cherry-pick topics based on areas of interest. For independent reviews and reader feedback, see reddit and Goodreads.
The book is distributed in electronic form (PDF) with a detailed table of contents and is fully searchable. All payments and product downloads are handled securely through SendOwl.
Every chapter concludes with a Recommended Practices section, which even experienced CMake users should find helpful. Upcoming chapters will cover features for building documentation and automating code checks such as clang-tidy, include-what-you-use, etc.
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.
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.
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 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.
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 dependencies and making their own project available for consumption by others, discussing 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 chapter dedicated to project organization brings together much of the earlier material, demonstrating how to structure a CMake project to improve its maintainability, make day-to-day development more convenient and shorten the path for new developers joining the project. A chapter is 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 topic of Qt support. It includes discussion of features provided by both CMake and Qt, covering topics including
rcc support, translation handling and using Qt’s deployment tools.
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.
The book is only available in electronic form at this time. Buyers are permitted to print their own personal copy if they so wish.
The book is only available in PDF form at this time.
The book is only available directly from the Crascit website.
For some countries, complying with the local tax laws as a foreign business selling into that country is not practical given the level of sales and the complexity of compliance. Unfortunately, this means that in some cases, certain countries are blocked from purchasing the book (these are typically non-EU countries with no minimum threshold before VAT must be applied). Note that the restriction only applies to the purchase itself. If the purchase is made outside of the restricted country (e.g. when travelling or as a gift by a third party), downloads will still be available.