There is growing excitement around Reflection in C++26 and the promise of language-integrated code generation. While these features will be valuable, it often takes nearly a decade for new C++ standards to see widespread, production-grade adoption. But what can we do now? Many of us need robust solutions between now and 2036.
That is why C and C++ projects already rely heavily on code generation today. At Bloomberg, we routinely integrate code generation into C++ systems for use cases such as feature flag APIs, schema-driven transport layers, cross-language interop layers, and embedding data directly into applications.
These systems are large, long-lived, and built using existing tools — most notably CMake.
This talk focuses on how to integrate code generation cleanly and maintainably into a C++ project using CMake. We will look at patterns for treating code generators as first-class build dependencies, managing generated source code, integrating into packaging systems, supporting a great developer experience, and avoiding common pitfalls that lead to fragile build systems.
This talk covers principles for how generators, build systems, and code consumption need to cooperate. An open source reference project will also be shared to demonstrate these ideas concretely. Attendees will leave with tools, examples, and ideas they can adapt to their own projects today.
View Slides
Bret likes making authoring and maintaining C++ codebases simpler and more intuitive by treating projects more like cattle and less like pets. He is especially interested in the software development lifecycle, development automation, modern build systems, packaging, code transformation, software governance, and code analysis.
Bret is currently an engineer in Bloomberg's developer experience department. He has worked in embedded C++ and safety critical C++ for previous employers.