r/cpp • u/not_a_novel_account cmake dev • Jun 01 '26
BMI Compatibility: Testing Build System C++ Modules Support
https://blog.vito.nyc/posts/bmi-compatibility/
68
Upvotes
r/cpp • u/not_a_novel_account cmake dev • Jun 01 '26
View all comments
2
u/kamrann_ Jun 02 '26
Thanks for a great article.
This is an area of modules that I've never really got my head around, probably largely because I use build2 and work on a single project where all dependencies are compiled from source with a consistent language standard.
I'm curious about the potential dangers of recompiling BMIs from the consumer's context. If I understand right (and maybe I don't), it seems as if the XMake approach is essentially trading off a significant chunk of the ODR benefits modules were intended to provide? Recompiling with consumer definitions can presumably lead to the exact same kinds of problems you can get traditionally by having a mix of compiler/preprocessor options amongst TUs that share headers. Are there any guarantees even with CMake's less aggressive approach? Can't a swapped in language standard or compiler option lead to the consumer seeing a symbol which wasn't emitted into the upstream module unit object file? Or worse still, a mismatch in something like observed
sizeof(Type)?The example with the private header seems a little strange to me. The notion of a private header presumably means that in a traditional non-modules project, it would only have been included from cpp files or other private headers, allowing the build system to avoid propagating its path; in which case, why is it being included in a module interface in the first place? Or to look at it from the other way around, if it's included in an interface, then implicitly it's not private, and its path needs to be propagated.