cmGeneratorTarget: discover synthetic targets recursively

Fixes: #25288
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 3cfa5a9..40711a3 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -8380,6 +8380,7 @@
         auto gtp = cm::make_unique<cmGeneratorTarget>(tgt, lg);
         synthDep = gtp.get();
         cache.CxxModuleTargets[targetName] = synthDep;
+        gtp->DiscoverSyntheticTargets(cache, config);
         lg->AddGeneratorTarget(std::move(gtp));
       } else {
         synthDep = cached->second;