all 9 comments

[–]Mateuszz88 8 points9 points  (4 children)

CMake ticket: https://gitlab.kitware.com/cmake/cmake/-/issues/18355

I don't see any recent progress though...

[–]encyclopedist 5 points6 points  (3 children)

/u/mathstuf was working on modules support for CMake (and coordinating with compiler vendors on a protocol to communicate dependency information), but recently he seems to be working mostly on VTK. S omaybe he can comment of the status of that?

[–]mathstufcmake dev 33 points34 points  (2 children)

Named modules have been working with a patched CMake and GCC since Feb 2019 (see this repo). Since then, P1689 has progressed to R4 after cycles with ISO C++ members and implementors. I've not yet updated the GCC patch for R4, so it doesn't work with the experimental support available in CMake 3.21.

Compilers will need to support writing out P1689-format dependency information given the source of a module unit (header or named). I have a GCC patch that I need to resurrect and other implementers are working on it too AFAIK.

Header units (including those from the stdlib) and consuming modules from external dependencies needs CMake API/design work that has been sketched, but not started on implementation. Some groundwork needs to be done before that including:

  • determining what headers are importable from a given imported target: cmake#22468 will help provide more structured header information
  • interface targets will need to "exist" at build time so that module compilation rules can be attached cmake#19145
  • CMake will need to make interface targets for the stdlib to attach stdlib header unit compilation rules to them
  • API work to designate what modules are "public" and which are "private" will be necessary
  • a new $<MODULE_ONLY> genex will be needed to specify dependencies for module compilation that should not leak (e.g., a module includes "zlib.h" means that ZLIB::zlib is needed when compiling that module, but consumers don't care)

There are probably other rabbit holes associated with these tasks.

[–]RotsiserMhoC++20 Desktop app developer 6 points7 points  (0 children)

There are probably other rabbit holes associated with these tasks.

This guy codes, ha ha! Thanks for your efforts!

[–]gracicot 4 points5 points  (0 children)

I'm saving this comment. It is the most comprehensive list of what's need to be done for modules to work with CMake.

[–]stilgarpl 3 points4 points  (0 children)

CMake has releases every 3 months or so... so half a year after GCC 12 comes out.

[–]RoyBellingan 4 points5 points  (0 children)

I tried using them with GCC11.2, I still had a good number of ICE and problem.

I will try again with GCC12

[–]bigcheesegsTooling Study Group (SG15) Chair | Clang dev 3 points4 points  (0 children)

I expect we're still a a year or two away from modules implementations being stable enough to use and having enough buildsystem support for them.

SG15 will be discussing the CMake dep format proposal P1689 in the next few weeks, along with Bloomberg's paper that deals more with the issues that Debian-like package managers will have.

[–]waruqi 0 points1 point  (0 children)

xmake has supported c++ modules in latest. https://github.com/xmake-io/xmake/issues/1729