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/not_a_novel_account cmake dev Jun 07 '26 edited Jun 07 '26
I don't follow.
On Thursday I built a library,
provider, using its own build system, who cares which. It builds itself with C++23.The installed artifacts are a shared library,
provider.so; an interface unit which contains the declarations,provider.cppm; a pre-built BMI for compatible consumers,provider.bmi; and a module manifest which records the includes, definitions, and other flags used to generate the BMI,provider.modules.json.On Friday I want to build my application,
consumer.consumerbuilds with C++26.consumer's build system reads theprovider.modules.json.How does the build system determine BMI compatibility? What flags should it swap to generate a BMI for
providersuch thatconsumercan gain access the declarations needed to useprovider?When we used headers we reinterpreted the declarations in the context of
consumernaturally, the preprocessor copy-pasted them into our TUs and the compiler parsed them in the context of that TU. We modified the provided flags (frompkg-configor whatever), combining the consumer's flags with those of the provider to make the compilation successful.