I’m working through the new C++20 modules support, in particular the CMake docs around this new feature. Based on what I see in the cmake-cxxmodules
manual, the target_sources()
command help, the install()
command help, and the CMP0155
policy help, it seems like file sets of type CXX_MODULES
are only really relevant if you intend to install a target. Based on the cmake-cxxmodules
manual, the source files are still going to be scanned for typical cases even without any CXX_MODULES
file sets (as long as CMP0155
is set to NEW
). Am I missing something?
I’m also finding the install(TARGETS)
documentation a bit confusion for file set handling. There’s both the FILE_SET
and CXX_MODULES_BMI
keywords, and it isn’t all that obvious why two separate things are needed for installing a CXX_MODULES
file set. From what I can tell, the FILE_SET
part would be needed to install C++ source files with exported modules because right now, the binary compatibility of BMI’s is tough. My understanding is the user’s compiler is probably going to need to compile its own BMI unless it they are using the exact same version of the compiler as the ones installed with the CXX_MODULES_BMI
argument, and they potentially use the same or very similar compiler flags. There’s no hint of these subtleties in our docs, and I suspect we may get queries about this with the docs as they stand. I’m also very likely misunderstanding the latest state of the compilers and BMI compatibility, so please do correct me where needed.
Sorry the above is a bit rushed and vague, I’d prefer to provide a more considered and tested query, but my availability at the moment is limited and unpredictable. Hopefully the above is enough to spur discussion around this though. I hope to spend more time on this area next week (from a documentation perspective), so getting a few basics ironed out ahead of that will be helpful.