summaryrefslogtreecommitdiff
path: root/xmake/rules/c++/modules
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2022-08-03 03:24:25 +0200
committerArthur LAURENT <[email protected]>2022-08-03 03:24:25 +0200
commitfd7340759c71bd253da2d2ccaeede55fb57dfa24 (patch)
tree1ed333cba84efa481244efdfddebbdfe41544240 /xmake/rules/c++/modules
parentd01b160c0e0f007ca0e8fc3c97ad47d3f79ace9c (diff)
[C++20] Improve target_with_modules detection
Diffstat (limited to 'xmake/rules/c++/modules')
-rw-r--r--xmake/rules/c++/modules/xmake.lua15
1 files changed, 11 insertions, 4 deletions
diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua
index f4b2498d7..fd178f1d8 100644
--- a/xmake/rules/c++/modules/xmake.lua
+++ b/xmake/rules/c++/modules/xmake.lua
@@ -26,12 +26,19 @@ rule("c++.build.modules")
add_deps("c++.build.modules.install")
on_config(function (target)
- local target_with_modules = target:sourcebatches()["c++.build.modules"] and true or false
-
- for _, dep in ipairs(target:orderdeps()) do
- target_with_modules = dep:sourcebatches()["c++.build.modules"] and true or target_with_modules
+ function contains_modules(target)
+ local target_with_modules
+ for _, dep in ipairs(target:orderdeps()) do
+ local sourcebatches = dep:sourcebatches()
+ if sourcebatches and sourcebatches["c++.build.modules"] then
+ target_with_modules = true
+ break
+ end
+ end
+ return target_with_modules
end
+ local target_with_modules = target:sourcebatches()["c++.build.modules"] and contains_modules(target) or false
if target_with_modules then
-- we disable to build across targets in parallel, because the source files may depend on other target modules
-- @see https://github.com/xmake-io/xmake/issues/1858