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
Show parent comment
1
u/kamrann_ Jun 02 '26
My assumption was if it led to declaration mismatches in something like an inline function or template, then this would constitute an ODR violation. Perhaps my understanding of the term is off, but anyway yes it's the declaration/definition mismatch risk that I was referring to.
I suppose I'm just unclear on what constitutes a justified context for option swapping that isn't a liability. I guess it's implementation dependent, and maybe in general you can't say up front that it's benign or not without knowing what the consumer is doing. In which case supporting this (as opposed to the "build everything with the same options" requirement) is just pragmatism in a world where builds do complicated, less than ideal things?
Maybe I'm misunderstanding your idea of a private header. To me, the only definition I know of is in the context of interface/implementation split for libraries, where a private header is one that is only depended on by the implementation and wouldn't be installed as part of the public interface of a library. In that context, a module interface unit source file is itself part of the public interface (it must be installed so downstream consumers can build the BMI), and so that precludes #including any private, non-installed headers into it.