summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2024-02-27 16:53:32 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2024-04-11 14:19:44 (GMT)
commit2c8361f923317a784adfa6502e1a0c3a17c1dff9 (patch)
tree478f836e3188a45bd2168cfe48568adce0451c23 /Source/cmGlobalGenerator.cxx
parent15cd73d6c24a2ad888d5c324a64fc7ea4b760d91 (diff)
downloadCMake-2c8361f923317a784adfa6502e1a0c3a17c1dff9.zip
CMake-2c8361f923317a784adfa6502e1a0c3a17c1dff9.tar.gz
CMake-2c8361f923317a784adfa6502e1a0c3a17c1dff9.tar.bz2
cxxmodules: link to `std`-providing targets when available
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index c0af34b..e397fa2 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1594,6 +1594,16 @@ bool cmGlobalGenerator::Compute()
}
}
+ // We now have all targets set up and std levels constructed. Add
+ // `__CMAKE::CXX*` targets as link dependencies to all targets which need
+ // them.
+ //
+ // Synthetic targets performed this inside of
+ // `cmLocalGenerator::DiscoverSyntheticTargets`
+ if (!this->ApplyCXXStdTargets()) {
+ return false;
+ }
+
// Iterate through all targets and set up C++20 module targets.
// Create target templates for each imported target with C++20 modules.
// INTERFACE library with BMI-generating rules and a collation step?
@@ -1830,6 +1840,19 @@ void cmGlobalGenerator::ComputeTargetOrder(cmGeneratorTarget const* gt,
entry->second = index++;
}
+bool cmGlobalGenerator::ApplyCXXStdTargets()
+{
+ for (auto const& gen : this->LocalGenerators) {
+ for (auto const& tgt : gen->GetGeneratorTargets()) {
+ if (!tgt->ApplyCXXStdTargets()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
bool cmGlobalGenerator::DiscoverSyntheticTargets()
{
cmSyntheticTargetCache cache;