Re: State and plans for C++20 module support?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 21, 2025 at 09:40:45 -0500, Paul Smith wrote:
> On Fri, 2025-02-21 at 12:26 +0100, Ben Boeckel wrote:
> > CMake's Makefile implementation can support it; it supports Fortran
> > modules after all. However, `ninja` support is far easier as it (in
> > CMake's implementation) has a single graph for the entire build. The
> > Makefiles generator is a 3-level recursive make in order to implement
> > things like CMake's per-directory entry points. Implementing C++
> > modules and fixing the *ninja* build graph found a number of
> > assumptions that this structure ends up relying on to provide CMake's
> > semantics to projects. A rewrite of the Makefiles generator to not
> > require this is something we'd like to do, but there's no real way to
> > put it on the timeline at the moment. Basically it would look like
> > the Ninja generator output where there's a single build graph instead
> > of the static recursion level.
> 
> I fully agree that the makefiles generated by cmake are... sub-optimal.
> 
> Automake-generated makefiles use a single build graph (or can do so)
> and they are POSIX-standard makefiles.  So it should be possible to
> create POSIX-standard makefiles which still have these features.  This
> is actually simpler for CMake than for "hand-rolled" makefile
> environments since the generated makefiles can avoid tricky parts like
> conditionalized content, implicit rules, etc.
> 
> I think it should be possible to preserve the per-directory entry
> points, now that POSIX make supports "include".

Does it preserve the "defer actually including until its associated
recipe is up-to-date" behavior? If my memory serves at least…I've been
able to live happily in ninja-land for a long time :) .

> Another alternative is to leave the UNIX Makefiles generator as-is, and
> create a new generator for GNU Make makefiles, which take full
> advantage of GNU Make features. 
> 
> I don't have any idea what the appetite is in CMake-land for doing this
> work.

Right now, CMake also makes POSIX-compatible Makefiles (and we now
generate a complete suppression of builtin rules since I discovered the
last batch when debugging the graph and had to skip over the builtin CVS
rules cluttering the logs). I'm not sure the prevalence of non-GNU make
usage (perhaps all of those users have already migrated to Ninja?), but
a new `GNU Makefiles` generator could be a thing. Ideally it would share
a lot of its implementation with the existing Ninja generators. But
again, it's not on our (Kitware's) road map at the moment either (though
it is on the wishlist).

Thanks,

--Ben




[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux