Skip to content

Commit 5d28f36

Browse files
committed
add requested changes
1 parent e2722a2 commit 5d28f36

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

xmake/modules/package/tools/cmake.lua

+7-8
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,9 @@ end
369369
-- get ninja
370370
function _get_ninja(package)
371371
local ninja = find_tool("ninja")
372-
assert(ninja, "ninja not found!")
373-
return ninja.program
372+
if ninja then
373+
return ninja.program
374+
end
374375
end
375376

376377
-- https://github.com/xmake-io/xmake-repo/pull/1096
@@ -771,10 +772,8 @@ function _get_configs_for_generator(package, configs, opt)
771772
table.insert(configs, "-G")
772773
table.insert(configs, _get_cmake_generator_for_msvc(package))
773774
elseif package:is_plat("wasm") and is_subhost("windows") then
774-
if not find_tool("ninja") then
775-
table.insert(configs, "-G")
776-
table.insert(configs, "MinGW Makefiles")
777-
end
775+
table.insert(configs, "-G")
776+
table.insert(configs, "MinGW Makefiles")
778777
else
779778
table.insert(configs, "-G")
780779
table.insert(configs, "Unix Makefiles")
@@ -1152,8 +1151,8 @@ function _get_cmake_generator(package, opt)
11521151
if package:has_tool("cc", "clang_cl") or package:has_tool("cxx", "clang_cl") then
11531152
cmake_generator = "Ninja"
11541153
elseif is_subhost("windows") and package:is_plat("mingw", "wasm") then
1155-
local mingw_make = _get_mingw32_make(package)
1156-
if not mingw_make and find_tool("ninja") then
1154+
local ninja = _get_ninja(package)
1155+
if ninja then
11571156
cmake_generator = "Ninja"
11581157
end
11591158
end

0 commit comments

Comments
 (0)