summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2026-06-17 23:49:50 +0800
committerruki <[email protected]>2026-06-17 23:49:50 +0800
commiteba488dafedd88c1f19e23132276872aac877b73 (patch)
treea577ac74585545b465b12caa03480d7665f2f5d6 /xmake/modules
parentba2df770b8430a8f8e593d34dc05de051a59a1bd (diff)
add targets arugment support
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/private/action/utils.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/xmake/modules/private/action/utils.lua b/xmake/modules/private/action/utils.lua
index 9b83b59ab..c31735c54 100644
--- a/xmake/modules/private/action/utils.lua
+++ b/xmake/modules/private/action/utils.lua
@@ -32,3 +32,28 @@ function get_target_and_group()
end
return targetname, group_pattern
end
+
+-- get target names and group pattern from option
+--
+-- it supports building multiple targets, e.g. `xmake build target1 target2 ...`
+-- and is compatible with the legacy single `target` option passed programmatically.
+--
+function get_targets_and_group()
+ local targetnames
+ local group_pattern = option.get("group")
+ if group_pattern then
+ group_pattern = "^" .. path.pattern(group_pattern) .. "$"
+ else
+ targetnames = option.get("targets")
+ if not targetnames then
+ local targetname = option.get("target")
+ if targetname then
+ targetnames = {targetname}
+ end
+ end
+ if targetnames then
+ targetnames = table.wrap(targetnames)
+ end
+ end
+ return targetnames, group_pattern
+end