summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2024-03-01 13:03:37 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2024-04-11 14:19:44 (GMT)
commit15cd73d6c24a2ad888d5c324a64fc7ea4b760d91 (patch)
tree86b07a6706edbedcda98e5cdbeb07e5c2c6da363 /Source/cmGeneratorTarget.cxx
parentd7e65b61781fdd3598c2115e10723449dde2f2e4 (diff)
downloadCMake-15cd73d6c24a2ad888d5c324a64fc7ea4b760d91.zip
CMake-15cd73d6c24a2ad888d5c324a64fc7ea4b760d91.tar.gz
CMake-15cd73d6c24a2ad888d5c324a64fc7ea4b760d91.tar.bz2
cmGlobalGenerator: compute target features before synthetic targets
For `import std;` support, CMake needs to know the standard library involved in order to ensure that the right target is linked. Afterwards, the created synthetic targets need their target compile features computed.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 2ec1a29..f0acb9c 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -8414,6 +8414,8 @@ void ComputeLinkImplTransitive(cmGeneratorTarget const* self,
bool cmGeneratorTarget::DiscoverSyntheticTargets(cmSyntheticTargetCache& cache,
std::string const& config)
{
+ std::vector<std::string> allConfigs =
+ this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
cmOptionalLinkImplementation impl;
this->ComputeLinkImplementationLibraries(config, impl, this,
LinkInterfaceFor::Link);
@@ -8488,9 +8490,19 @@ bool cmGeneratorTarget::DiscoverSyntheticTargets(cmSyntheticTargetCache& cache,
// Create the generator target and attach it to the local generator.
auto gtp = cm::make_unique<cmGeneratorTarget>(tgt, lg);
+
synthDep = gtp.get();
cache.CxxModuleTargets[targetName] = synthDep;
+
+ // See `localGen->ComputeTargetCompileFeatures()` call in
+ // `cmGlobalGenerator::Compute` for where non-synthetic targets resolve
+ // this.
+ for (auto const& innerConfig : allConfigs) {
+ gtp->ComputeCompileFeatures(innerConfig);
+ }
+
gtp->DiscoverSyntheticTargets(cache, config);
+
lg->AddGeneratorTarget(std::move(gtp));
} else {
synthDep = cached->second;