diff options
| author | fasiondog <[email protected]> | 2022-01-09 23:07:48 +0800 |
|---|---|---|
| committer | fasiondog <[email protected]> | 2022-01-09 23:07:48 +0800 |
| commit | a9590e436e0054e2ee9b952f3d0f1f2310c6f002 (patch) | |
| tree | 9c66be7d10e6d70103d9347460cde2a60d6d1114 /xmake/modules | |
| parent | 80e1bd8df356ab25802e518bac38aff7dfe45702 (diff) | |
Improve cmake_build, supports the specified config and target
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 18 |
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 |
