summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules/modules_support/msvc.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-12-07 22:56:12 +0800
committerGitHub <[email protected]>2022-12-07 22:56:12 +0800
commitfff1a89bb33b4c5dd99307eca8d12b65452d5806 (patch)
tree5d07c9ad5157e36fde51afd4e1211def01de445d /xmake/rules/c++/modules/modules_support/msvc.lua
parent148c595c7b552d08573d8d1c12b7c97951c8498a (diff)
parent911e781d4b2a4aa4260fba1b2c012855c7ee1d9b (diff)
Merge pull request #3141 from Arthapz/fix-gcc-link-module-order
Fix import order on GCC and force it on clang and msvc
Diffstat (limited to 'xmake/rules/c++/modules/modules_support/msvc.lua')
-rw-r--r--xmake/rules/c++/modules/modules_support/msvc.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/xmake/rules/c++/modules/modules_support/msvc.lua b/xmake/rules/c++/modules/modules_support/msvc.lua
index c360cb2eb..756f19703 100644
--- a/xmake/rules/c++/modules/modules_support/msvc.lua
+++ b/xmake/rules/c++/modules/modules_support/msvc.lua
@@ -719,12 +719,19 @@ function get_requiresflags(target, requires, opt)
local flags = {}
local modulemap = _get_modulemap_from_mapper(target)
-- add deps required module flags
+ local already_mapped_modules = {}
for name, _ in table.orderpairs(requires) do
+ -- if already in flags, continue
+ if already_mapped_modules[name] then
+ goto continue
+ end
+
for _, dep in ipairs(target:orderdeps()) do
local modulemap_ = _get_modulemap_from_mapper(dep)
if modulemap_[name] then
table.join2(flags, modulemap_[name].flag)
table.join2(flags, modulemap_[name].deps or {})
+ already_mapped_modules[name] = true
if os.isfile(modulemap_[name].objectfile) then
_add_objectfile_to_link_arguments(target, modulemap_[name].objectfile)
end