@@ -128,7 +128,8 @@ std::vector<TransitiveUsage> GetTransitiveUsages(
128
128
}
129
129
130
130
std::string CxxModuleMapContentClang (CxxModuleLocations const & loc,
131
- cmScanDepInfo const & obj)
131
+ cmScanDepInfo const & obj,
132
+ CxxModuleUsage const & usages)
132
133
{
133
134
std::stringstream mm;
134
135
@@ -151,12 +152,11 @@ std::string CxxModuleMapContentClang(CxxModuleLocations const& loc,
151
152
break ;
152
153
}
153
154
}
154
- for (auto const & r : obj.Requires ) {
155
- auto bmi_loc = loc.BmiGeneratorPathForModule (r.LogicalName );
156
- if (bmi_loc.IsKnown ()) {
157
- mm << " -fmodule-file=" << r.LogicalName << " =" << bmi_loc.Location ()
158
- << ' \n ' ;
159
- }
155
+
156
+ auto all_usages = GetTransitiveUsages (loc, obj.Requires , usages);
157
+ for (auto const & usage : all_usages) {
158
+ mm << " -fmodule-file=" << usage.LogicalName << ' =' << usage.Location
159
+ << ' \n ' ;
160
160
}
161
161
162
162
return mm.str ();
@@ -420,7 +420,7 @@ std::string CxxModuleMapContent(CxxModuleMapFormat format,
420
420
{
421
421
switch (format) {
422
422
case CxxModuleMapFormat::Clang:
423
- return CxxModuleMapContentClang (loc, obj);
423
+ return CxxModuleMapContentClang (loc, obj, usages );
424
424
case CxxModuleMapFormat::Gcc:
425
425
return CxxModuleMapContentGcc (loc, obj);
426
426
case CxxModuleMapFormat::Msvc:
0 commit comments