6 Commits
Author SHA1 Message Date
Vito Gamberini 6fb8e308df c++modules: Account for preprocessor flags in compile options
Fixes: #27973
2026-07-23 09:19:13 -04:00
Vito Gamberini 42d2d63235 c++modules: Copy props from BMI consumers more correctly
Fixes: #27891
2026-06-19 09:23:38 -04:00
Vito Gamberini bfba7f68af c++modules: Correctly calculate and apply usage effects
Usage effects describe the relationship between a provider and a
consumer of C++ module interface units. They encompass the flags and
features used to construct BMIs for those units. If the usage effects of
a provider and consumer match, then the provider's BMI may be reused
as-is. If they do not match, then a synthetic target describing the
interface units with the consumer's usage effects applied must be
created.

This commit makes three major changes to how usage effects are reified
in CMake. The first is simple, usage effect hashes now use compile
options and features as the input to their hash instead of the consumer
name. A simply warning flag filter is also applied, mostly to
demonstrate the mechanism. This is the "correct calculation" for usage
effects.

The second is more impactful, usage effects now entirely replace the
compile options of providers with those of consumers if unmatched.
Compile definitions, includes, and links remain unchanged. This is
necessary to ensure successful builds, but is a tricky semantic change.

The third is mostly source-facing, the discovery model for CxxModule
synthetic targets is no longer the global target namespace. Instead,
non-synthetic targets manage their synthetic derivatives. Every target
maintains a usage effect-keyed cache of synthetic targets. When
determining if a synthetic target is necessary, a given provider checks
for compatibility with itself, then for presence in the cache, and if
the cache misses a new synthetic target is created.

Fixes: #27597
2026-06-02 15:41:40 -04:00
Daniel Tierney 5c00749c5d cmCxxModuleUsageEffects: Collect and apply BMI compatibility requirements
This gathers properties and other details affecting Built Module Interface (BMI)
compatibility for C++ module importers and applies them as necessary to
synthetic targets, which represent a specific module import scenario.
2026-02-09 14:16:18 -05:00
Kitware Robot 1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05:00
Ben Boeckel cb356b540c cmCxxModuleUsageEffects: add a class to capture module usage effects
When importing a C++ module, there may be requirements imposed by the
importer so that the compiler can reliably read the BMI. For example,
the standard used in the importer may need to also apply to the imported
BMI.

Right now, there are no tracked requirements. As we learn more, this
class can start tracking more information.

See: https://wg21.link/p2581r2
2023-08-17 14:42:53 -04:00