![]() If you're interested in becoming a professional build engineer, a better software developer, or simply want to become proficient with CMake, if you'd like to understand how projects come together and why, if you're transitioning from a different build environment, or if you're interested in learning modern CMake from the ground up, then this book is for you. Learning the C++ language often isn't enough to prepare you for delivering projects to the highest standards. After completing this book, you'll be able to use CMake confidently on a professional level. Finally, you'll explore how to export, install, and package your solution for internal and external purposes. You'll also understand how to add external dependencies to the project: third-party libraries, testing frameworks, program analysis tools, and documentation generators. As you progress, you will learn how to compile and link executables and libraries, how these processes work in detail, and how to optimize all steps to achieve the best results. The book instructs you on how to form the source directories, as well as build targets and packages. It guides you through the automation of complex tasks appearing in many projects, including building, testing, and packaging. It teaches you how to use CMake in your CMake projects, and also shows you what makes them maintainable, elegant, and clean. Modern CMake for C++ is an end-to-end guide offering a simpler experience, as it treats building C++ solutions in a comprehensive manner. ![]() At the same time, most resources explain this process chaotically, without the proper background, context, and structure. For everything else, the targets can be created manually after the dependency has been downloaded (see the snippets below for examples). Developers researching this subject online frequently have problems determining which advice is up to date and which approaches have already been superseded by fresher, better practices. Projects using modern CMake are automatically configured and their targets can be used immediately. Does this look familiar to you?įind_package (Boost 1.Creating top-notch software isn't an easy task. Daniel, I am your prophet.Įnough preambles. Daniel has practically become the Messiah of the modern CMake church, preaching best practices and guidelines in a time when the only standard is to not have one. Many of the concepts presented here find their roots in Daniel Pfeifer’s masterpiece Effective CMake. My intention is to show how “new” (>= 3.0.0) features can be employed to reshape your CMake system into a more maintainable and intuitive alternative that actually makes sense. This post explores the concepts of what is known as modern CMake, which advocates for abandoning a traditional variable-based approach for a more structured model based on so-called targets. My excitement was soon shattered after discovering the lack of standard practices in CMake usage and specially the insufficient adoption of modern design patterns. Most people I know would have avoided such enterprise at all costs, but there is something about writing find modules that makes my brain release endorphins. The idea was to evaluate existing components, dependencies, but most importantly, to establish a superior design by making use of modern CMake features and paradigms. Not so long ago I got the task of rethinking our build system.
0 Comments
Leave a Reply. |