diff options
| -rw-r--r-- | xmake/rules/utils/merge_archive/xmake.lua | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/xmake/rules/utils/merge_archive/xmake.lua b/xmake/rules/utils/merge_archive/xmake.lua index 1d4fe78a2..ad5039a89 100644 --- a/xmake/rules/utils/merge_archive/xmake.lua +++ b/xmake/rules/utils/merge_archive/xmake.lua @@ -31,18 +31,17 @@ rule("utils.merge.archive") dep:data_set("inherit.links.deplink", false) end end - end - local sourcefiles - local sourcebatch = target:sourcebatches()["utils.merge.archive"] - if sourcebatch and sourcebatch.sourcefiles then - sourcefiles = sourcebatch.sourcefiles - target:data_set("merge_archive.sourcefiles", sourcefiles) - end - if not (target:is_static() and (target:policy("build.merge_archive") or sourcefiles)) then + else target:rule_enable("utils.merge.archive", false) end end) + on_build_files(function (target, sourcebatch, opt) + if sourcebatch.sourcefiles then + target:data_set("merge_archive.sourcefiles", sourcebatch.sourcefiles) + end + end) + after_link(function (target, opt) if not target:is_static() then return |
