summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-01-09 21:55:47 +0800
committerGitHub <[email protected]>2022-01-09 21:55:47 +0800
commit2431dd7e6142ff98b55741cfd4de4d2e69f4f8b5 (patch)
tree2a51c869a3aea1a093ed569e749bdf0465634a6c
parent175c4cb26d1ca68a1ef90c78e5d99e7252cc02a8 (diff)
parent80e1bd8df356ab25802e518bac38aff7dfe45702 (diff)
Merge pull request #1966 from fasiondog/master
Improve cmake.tool, make and ninja supports the specified target
-rw-r--r--xmake/modules/package/tools/cmake.lua6
-rw-r--r--xmake/modules/package/tools/ninja.lua7
2 files changed, 11 insertions, 2 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 4ced3e67d..f49cedf0b 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -554,8 +554,12 @@ end
-- do build for make
function _build_for_make(package, configs, opt)
+ local argv = {}
+ if opt.target then
+ table.insert(argv, opt.target)
+ end
local jobs = _get_parallel_njobs(opt)
- local argv = {"-j" .. jobs}
+ table.insert(argv, "-j" .. jobs)
if option.get("verbose") then
table.insert(argv, "VERBOSE=1")
end
diff --git a/xmake/modules/package/tools/ninja.lua b/xmake/modules/package/tools/ninja.lua
index e16731670..0d3ad9708 100644
--- a/xmake/modules/package/tools/ninja.lua
+++ b/xmake/modules/package/tools/ninja.lua
@@ -28,7 +28,12 @@ function build(package, configs, opt)
local buildir = opt.buildir or os.curdir()
local njob = opt.jobs or option.get("jobs") or tostring(os.default_njob())
local ninja = assert(find_tool("ninja"), "ninja not found!")
- local argv = {"-C", buildir}
+ local argv = {}
+ if opt.target then
+ table.insert(argv, opt.target)
+ end
+ table.insert(argv, "-C")
+ table.insert(argv, buildir)
if option.get("verbose") then
table.insert(argv, "-v")
end