summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/cmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-01-22 00:35:31 +0800
committerruki <[email protected]>2025-01-22 00:35:31 +0800
commit78371cb084abfe3e80e928adae4e55a0df98f34b (patch)
tree6ba87b37a28215b93ae98fa448a17341fa3324ed /xmake/modules/package/tools/cmake.lua
parent014838d6d7b370a0825ef320a0df30136d9ea0f1 (diff)
improve cmake for ninja
Diffstat (limited to 'xmake/modules/package/tools/cmake.lua')
-rw-r--r--xmake/modules/package/tools/cmake.lua14
1 files changed, 5 insertions, 9 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 501b52502..6faac6702 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -601,9 +601,6 @@ function _get_configs_for_mingw(package, configs, opt)
if is_subhost("windows") and opt.cmake_generator ~= "Ninja" then
envs.CMAKE_MAKE_PROGRAM = _get_mingw32_make(package)
end
- if opt.cmake_generator == "Ninja" then
- envs.CMAKE_MAKE_PROGRAM = "ninja"
- end
_fix_cxx_compiler_cmake(package, envs)
_insert_configs_from_envs(configs, envs, opt)
end
@@ -618,12 +615,7 @@ function _get_configs_for_wasm(package, configs, opt)
assert(emscripten_cmakefile, "Emscripten.cmake not found!")
table.insert(configs, "-DCMAKE_TOOLCHAIN_FILE=" .. emscripten_cmakefile)
if is_subhost("windows") then
- if opt.cmake_generator == "Ninja" then
- local ninja = _get_ninja(package)
- if ninja then
- table.insert(configs, "-DCMAKE_MAKE_PROGRAM=" .. ninja)
- end
- else
+ if opt.cmake_generator ~= "Ninja" then
local mingw_make = _get_mingw32_make(package)
if mingw_make then
table.insert(configs, "-DCMAKE_MAKE_PROGRAM=" .. mingw_make)
@@ -783,6 +775,10 @@ function _get_configs_for_generator(package, configs, opt)
table.insert(configs, "-DCMAKE_JOB_POOL_LINK:STRING=link")
table.insert(configs, ("-DCMAKE_JOB_POOLS:STRING=compile=%s;link=%s"):format(jobs, linkjobs))
end
+ local ninja = _get_ninja(package)
+ if ninja then
+ table.insert(configs, "-DCMAKE_MAKE_PROGRAM=" .. ninja)
+ end
end
elseif package:is_plat("mingw") and is_subhost("msys") then
table.insert(configs, "-G")