summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfasiondog <[email protected]>2022-01-09 16:13:31 +0800
committerfasiondog <[email protected]>2022-01-09 16:13:31 +0800
commit80e1bd8df356ab25802e518bac38aff7dfe45702 (patch)
treefc8d3d7d618368a2e5fbdab88ed6a0ea9fc273ed
parent187da27473c69bd9d7b0009d8d689ec924f16dfb (diff)
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