Skip to content

Commit 1dcfa0d

Browse files
committed
(C++ modules support) fix _patch_sourcebatch when a dep have a namespace
1 parent 5a580f0 commit 1dcfa0d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

xmake/rules/c++/modules/scanner.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,11 @@ function _get_targetdeps_modules(target)
296296
fileconfig.undefines = table.join(fileconfig.undefines or {}, dep:get("undefines") or {})
297297
fileconfig.includedirs = table.join(fileconfig.includedirs or {}, dep:get("includedirs") or {})
298298
if not dep:is_phony() then
299-
fileconfig.external = dep:fullname()
299+
if target:namespace() == dep:namespace() then
300+
fileconfig.external = dep:name()
301+
else
302+
fileconfig.external = dep:fullname()
303+
end
300304
fileconfig.bmionly = not dep:is_moduleonly()
301305
end
302306
if not modules[sourcefile] then
@@ -358,6 +362,7 @@ function _patch_sourcebatch(target, sourcebatch)
358362
local strict = target:policy("build.c++.modules.reuse.strict") or
359363
target:policy("build.c++.modules.tryreuse.discriminate_on_defines")
360364
local dep = target:dep(fileconfig.external)
365+
assert(dep, format("dep target <%s> for <%s>", fileconfig.external, target:fullname()))
361366

362367
local can_reuse = nocheck or _are_flags_compatible(target, dep, sourcefile, {strict = strict})
363368
if can_reuse then

0 commit comments

Comments
 (0)