Skip to content

ninja: Add experimental infrastructure for C++20 module dependency scanning

Brad King requested to merge brad.king/cmake:cpp-modules into master

Optionally enable this infrastructure through an undocumented CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP variable. Currently this is experimental and intended for use by compiler writers to implement their scanning tools. Warn as such when the feature is activated. Later when compilers provide the needed scanning tools we can enable this variable from our corresponding compiler information modules. It is never meant to be set by project code in production.

When enabled, generate a build graph similar to what we use for Fortran module dependencies. There are some differences needed because we can scan dependencies without explicit preprocessing, and can directly compile the original source afterward.

Document the experimental feature in Help/dev/experimental.rst.

The approach is described by Kitware's D1483r1 paper. The module dependencies format is that described by Kitware's P1689r3 paper.

Issue: #18355 (closed)
Co-Author: @ben.boeckel

Edited by Brad King

Merge request reports