This video features an interview with Rafal Switzinski, author of the second edition of "Modern CMake for C++". Switzinski discusses the book's motivation: to provide a comprehensive and cohesive guide for C++ developers navigating modern CMake practices, moving away from outdated or legacy approaches. He outlines the book's structure, covering fundamentals, the CMake language, setting up projects, managing dependencies, the current state of C++20 module support within CMake, integrating testing frameworks (CTest), code analysis, documentation generation, packaging, and using CMake Presets. Switzinski emphasizes the book's focus on building professional C++ projects and explains how the second edition is a significant rewrite based on further learning. The discussion also touches upon the common difficulties users face with CMake, comparisons with other resources like Craig Scott's book, topics that didn't make the cut (like deeper library handling and package managers), and briefly, the author's current work involving AI in healthcare training.
Interview Summary: Modern CMake for C++ with Rafal Switzinski
0:00:04 Introduction: Interview with Rafal Switzinski about the second edition of his book, "Modern CMake for C++".
0:00:33 Author's Background: Rafal discusses his work experience (Google, Axon) and mentions using CMake even for Go projects.
0:02:54 Book's Purpose (2nd Edition): Aims to provide a cohesive, start-to-finish guide for building professional C++ projects using modern CMake, addressing the shortcomings and learnings from the first edition. It's designed to take developers from understanding C++ code to effectively building it with CMake.
0:06:05 C++20 Modules & CMake: Covers the challenges and state of C++20 module support in CMake at the time of writing. Notes it required specific compiler versions and hacks, with better native support arriving later (CMake 3.28+), but still considers it an evolving area.
0:08:42 Testing Frameworks & CTest: Emphasizes the importance of testing and highlights CMake's CTest tool as a powerful, standardized way to run tests across different frameworks, beneficial for team collaboration and consistency.
0:10:51 Professional Project Chapter (Ch 15): This chapter integrates all previously discussed concepts (dependencies, testing, packaging, analysis tools, documentation) into a practical example of building a complete, professional project structure using CMake.
0:12:32 CMake Presets: Explains the final chapter on CMake Presets, showcasing them as a method to simplify project configuration and building for end-users by defining common build scenarios and options.
0:14:31 Package Managers (Conan): Clarifies that external package managers like Conan are not covered in detail, mainly due to book scope and CMake focusing on its own packaging system (CPack).
0:15:51 Target Audience: Intended for C++ developers using CMake, including those who may have picked up CMake through "cargo-culting" and want a foundational understanding of modern practices.
0:17:47 Topics Not Included: Mentions deeper dives into library design/building best practices within CMake and C Dash (Kitware's CI/CD tool) as areas not covered extensively.
0:21:02 Learning C++ via CMake: Writing the book deepened the author's understanding of the C++ compilation and linking process, memory layout, and system-level interactions.
0:22:42 AI in Coding: Shares thoughts on AI's usefulness for boilerplate/API usage but cautions against its reliability for complex code edits and stresses the need for human review and testing.
0:25:40 Why People Dislike CMake: Attributes negativity often to outdated online resources promoting legacy practices, the inherent complexity compared to simple scripts, and misunderstanding its role as a meta-build system generator.
0:30:22 CMake Project Generators (e.g., CMake Init): Views generators as potential productivity aids but stresses the importance of understanding the generated CMake code for maintenance.
0:32:40 Author's CMake Journey: Describes learning and mastering CMake at Cisco Meraki while refactoring complex legacy projects, leading to an appreciation for its power in structuring code, which motivated the book.
0:35:24 Comparison to "Professional CMake" (Craig Scott): Positions his book as more focused on the C++ project lifecycle and integrating various tools (testing, analysis, docs) using CMake, whereas Scott's book is a comprehensive reference on CMake features themselves.
0:37:33 Second Edition as a Rewrite: Emphasizes that the second edition is substantially different and rewritten from the first, incorporating much more knowledge and better approaches.
0:40:00 Future CMake Directions: Discusses CMake's strengths (module ecosystem, cross-language support) and personal interest in higher-level packaging/delivery (e.g., Docker integration).
0:41:51 Current AI/Healthcare Project: Details a project using C++, CMake, Docker, and AI (vision/audio) to create a training platform for medical students.