C++ Modules: Getting Started Today
summary
C++20 modules see broad support in major compilers and CMake now offers practical integration, but they require the absolute latest toolchain (MSVC C++23 mode, clang 17+/trunk, recent GCC, Ninja or MSBuild) and some CMake file sets magic. Modules change the build graph: compilation emits an binary module interface (BMI) alongside objects and the build system does a two‑pass dependency scan, which can shrink incremental rebuilds but breaks if headers and imports mix (watch the global module fragment rules). Expect rough edges yet measurable wins.
AI-written summary · about
chapters (24)
- 0:00Introduction
- 0:38Overview
- 6:17How Modules Work
- 8:47Exports
- 15:27Primary
- 17:02Interface Implementation
- 19:02Interface Partitions
- 23:30Building Modules
- 26:37Additional Magic
- 27:20Requirements
- 28:58Rule of Thum
- 29:59File Extensions
- 31:20Build Systems
- 34:40Compiler
- 38:26Build System
- 41:12Advice
- 41:47Global Module Fragment
- 44:16Mixing Headers and Modules
- 48:07Include Guard
- 50:01Export using declarations
- 51:20Export using headers
- 52:23Clean interface
- 54:06Conclusion
- 56:39Questions
related talks
01h 04mC++ Modules - Getting started today
01h 00mSo, you want to use C++ Modules ... cross-platform?
01h 01mimport CMake; // Mastering C++ Modules
01h 02mModern CMake Modules
01h 01mC++ Modules and Large-Scale Development (Part 1)
01h 17mThe Importance of the C++ Build System Target Model
56mImplementing C++ Reflection Using the New C++20 Tooling Opportunity: Modules
55mModern CMake for modular design
