@@ -389,7 +389,12 @@ function _patch_sourcebatch(target, sourcebatch)
389389
390390 local can_reuse = nocheck or _are_flags_compatible (target , dep , sourcefile , {strict = strict })
391391 if can_reuse then
392- support .set_reused (target , dep , sourcefile )
392+ local _reused , from = support .is_reused (dep , sourcefile )
393+ if _reused then
394+ support .set_reused (target , from , sourcefile )
395+ else
396+ support .set_reused (target , dep , sourcefile )
397+ end
393398 table.insert (reused , sourcefile )
394399 if dep :is_moduleonly () then
395400 dep :data_set (" cxx.modules.reused" , true )
@@ -417,10 +422,15 @@ function _patch_sourcebatch(target, sourcebatch)
417422 if reused :has (sourcefile ) then
418423 local dep = target :dep (fileconfig .external )
419424 assert (dep , " dep target <%s> for <%s> not found" , fileconfig .external , target :fullname ())
425+ local _reused , from = support .is_reused (dep , sourcefile )
426+ if _reused then
427+ support .set_reused (target , from , sourcefile )
428+ else
429+ support .set_reused (target , dep , sourcefile )
430+ end
420431 if dep :is_moduleonly () then
421432 dep :data_set (" cxx.modules.reused" , true )
422433 end
423- support .set_reused (target , dep , sourcefile )
424434 end
425435 target :fileconfig_add (sourcefile , fileconfig )
426436 end
0 commit comments