[build2] C++ modules: how to generate the modules-list for own library
Boris Kolpackov
boris at codesynthesis.com
Wed May 10 12:58:13 UTC 2023
Wilhelm Meier <wilhelm.meier at hs-kl.de> writes:
> One additional question: I don't want to generate .o files from the module
> interface units, because they are "empty" (see my original posts of trying
> to port a header only libraray). So, I want to give the option
> "-fmodule-only" to the compiler for the *.mpp files and I don't want the .o
> files to be a prerequisite for the executable. How do I do that ?
You shouldn't. The object file for a named module (as opposed to a
header unit) is not optional, even if your module interface unit
is "empty". It may work in some cases, but there is no guarantee.
The -fmodule-only option for named modules is useful when the
object file for a module interface unit comes as part of a library
and all that's needed to be produces is its BMI (as is the case,
for example, for installed libraries). For such cases build2 passes
this option automatically.
More information about the users
mailing list