Jump to ratings and reviews
Rate this book

Modern CMake for C++: Effortlessly build cutting-edge C++ code and deliver high-quality solutions

Rate this book
Gain proficiency in CMake and unlock the complete potential of C++ to develop exceptional projects

Get With Your PDF Copy, AI Assistant, and Next-Gen Reader Free

Key FeaturesGet to grips with CMake and take your C++ development skills to enterprise standardsUse hands-on exercises and self-assessment questions to lock-in your learningUnderstand how to build in an array of quality checks and tests for robust codeBook DescriptionModern CMake for C++ isn't just another reference book, or a repackaging of the documentation, but a blueprint to bridging the gap between learning C++ and being able to use it in a professional setting. It's an end-to-end guide to the automation of complex tasks, including building, testing, and packaging software.

This second edition is significantly rewritten, restructured and refreshed with latest additions to CMake, such as support of C++20 Modules.

In this book, you'll not only learn how to use the CMake language in CMake projects but also discover how to make those projects maintainable, elegant, and clean. As you progress, you'll dive into the structure of source directories, building targets, and packages, all while learning how to compile and link executables and libraries. You'll also gain a deeper understanding of how those processes work and how to optimize builds in CMake for the best results. You'll discover how to use external dependencies in your project – third-party libraries, testing frameworks, program analysis tools, and documentation generators. Finally, you'll gain profi ciency in exporting, installing, and packaging for internal and external purposes.

By the end of this book, you'll be able to use CMake confi dently at a professional level.

What you will learnUnderstand best practices to build ++ codeGain practical knowledge of the CMake languageGuarantee code quality with tests and static and dynamic analysisDiscover how to manage, discover, download, and link dependencies with CMakeBuild solutions that can be reused and maintained in the long termUnderstand how to optimize build artifacts and the build processProgram modern CMake and manage your build processesAcquire expertise in complex subjects such as CMake presetsWho this book is forThe book is for build engineers and software developers with knowledge of C/C++ programming who are looking to learn CMake to automate the process of building small and large software solutions. If you’re just getting started with CMake, a long-time GNU Make user, or simply looking to brush up on the latest best practices, this book is for you.

Table of ContentsFirst Steps with CMakeThe CMake LanguageUsing CMake in Popular IDEsSetting Up Your First CMake ProjectWorking with TargetsUsing Generator ExpressionsCompiling C++ Sources with CMakeLinking Executables and LibrariesManaging Dependencies in CMakeUsing the C++20 ModulesTesting FrameworksProgram Analysis ToolsGenerating DocumentationInstalling and PackagingCreating Your Professional ProjectWriting CMake PresetsAppendix

502 pages, Paperback

Published May 28, 2024

Loading...
Loading...

About the author

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
3 (75%)
4 stars
1 (25%)
3 stars
0 (0%)
2 stars
0 (0%)
1 star
0 (0%)
Displaying 1 - 2 of 2 reviews
Profile Image for Giuseppe Guerra.
5 reviews
September 23, 2024
I think that "Modern CMake for C++" is the most comprehensive, exhaustive, and up-to-date resource available on CMake.

The book is aimed at both beginners and experienced developers. It is highly thorough as it starts with basic topics such as the fundamentals of the CMake language and the installation of necessary tools (I particularly appreciated the Docker image provided with everything needed) and then progresses to more advanced topics like dependency management, configuring code analysis tools, testing frameworks, and creating presets.

Why is it useful? Programming in C++ is already complex, and managing large projects is even more so, especially when considering the various issues related to build processes and distribution. In this book, you can clearly see how the author's experience and skills in this field come in handy for solving well-known problems.

What I particularly appreciated is the practical approach with which it is written: the examples provided are based on real-world project scenarios. Furthermore, one of the author's stated goals (which I believe has been fully achieved) is to illustrate modern and efficient techniques instead of the "established" but outdated and obsolete ones.

If I were to express any doubts, as a beginner, I did struggle a bit with some topics, likely due to my own gaps in knowledge, but a bit of deeper study was enough to overcome them.

In conclusion, I highly recommend this book for its practicality, completeness, and modern approach. Nowadays, knowing and mastering C++ is not enough to successfully distribute professional projects, which are constantly growing in size. "Modern CMake for C++" has been an invaluable aid in this journey and is, I would say, essential for anyone looking to master CMake and improve their workflow in C++ software development.
3 reviews1 follower
September 13, 2024
I recently read Modern CMake for C++, Second Edition and was thoroughly impressed. Despite considering myself highly technical and knowledgeable in CMake, I still learned a plethora of new information. The book covers a wide range of topics, from debugging a CMake project, understanding the grammar, targets, and package management like FetchContent, to using CMake in advanced IDEs.

One of the standout aspects of this book is its guidance on properly setting up a project. It emphasizes good practices, what to focus on when building a project, the hierarchy, and various gotchas to avoid. The book even delves into the linking models of C and C++ and how to handle them correctly in CMake.

This book is a must-read for every developer using CMake. By following the rules and best practices outlined, it will make your project healthier. Regardless of your experience level, you are bound to pick up new skills. The format and organization of this book are simply fabulous, making it highly recommended.
Displaying 1 - 2 of 2 reviews