summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/cmake.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/modules/package/tools/cmake.lua')
-rw-r--r--xmake/modules/package/tools/cmake.lua18
1 files changed, 16 insertions, 2 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index f49cedf0b..4e2662604 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -593,7 +593,16 @@ end
-- do build for cmake/build
function _build_for_cmakebuild(package, configs, opt)
local cmake = assert(find_tool("cmake"), "cmake not found!")
- os.vrunv(cmake.program, {"--build", os.curdir()}, {envs = opt.envs or buildenvs(package)})
+ local argv = {"--build", os.curdir()}
+ if opt.config then
+ table.insert(argv, "--config")
+ table.insert(argv, opt.config)
+ end
+ if opt.target then
+ table.insert(argv, "--target")
+ table.insert(argv, opt.target)
+ end
+ os.vrunv(cmake.program, argv, {envs = opt.envs or buildenvs(package)})
end
-- do install for msvc
@@ -662,7 +671,12 @@ end
function _install_for_cmakebuild(package, configs, opt)
opt = opt or {}
local cmake = assert(find_tool("cmake"), "cmake not found!")
- os.vrunv(cmake.program, {"--build", os.curdir()}, {envs = opt.envs or buildenvs(package)})
+ local argv = {"--build", os.curdir()}
+ if opt.config then
+ table.insert(argv, "--config")
+ table.insert(argv, opt.config)
+ end
+ os.vrunv(cmake.program, argv, {envs = opt.envs or buildenvs(package)})
os.vrunv(cmake.program, {"--install", os.curdir()})
end