cmDyndepCollation: record required modules to the build database
diff --git a/Source/cmDyndepCollation.cxx b/Source/cmDyndepCollation.cxx
index 800b395..e6ffe5a 100644
--- a/Source/cmDyndepCollation.cxx
+++ b/Source/cmDyndepCollation.cxx
@@ -644,6 +644,9 @@
             result = false;
           }
         }
+        for (auto const& req : object.Requires) {
+          bdb_entry->second->Requires.push_back(req.LogicalName);
+        }
       } else if (export_info.DatabaseInfo) {
         cmSystemTools::Error(cmStrCat(
           "Failed to find module database entry for ", file_set.SourcePath));