Browse Source

cmGeneratorTarget: add the original target as a COMPILE_ONLY link

Fixes: #25909
Ben Boeckel 1 year ago
parent
commit
2041f7c9bf
1 changed files with 4 additions and 0 deletions
  1. 4 0
      Source/cmGeneratorTarget.cxx

+ 4 - 0
Source/cmGeneratorTarget.cxx

@@ -8373,6 +8373,10 @@ bool cmGeneratorTarget::DiscoverSyntheticTargets(cmSyntheticTargetCache& cache,
         // generation.
         tgt->CopyImportedCxxModulesProperties(model);
 
+        tgt->AddLinkLibrary(*mf,
+                            cmStrCat("$<COMPILE_ONLY:", model->GetName(), '>'),
+                            GENERAL_LibraryType);
+
         // Apply usage requirements to the target.
         usage.ApplyToTarget(tgt);