From 5d28f368645e6f5ecc4fd0e2b0b6e542f809bfc1 Mon Sep 17 00:00:00 2001 From: Chi Huu Huynh <73843190+Chi-EEE@users.noreply.github.com> Date: Thu, 29 Aug 2024 15:45:57 +0100 Subject: add requested changes --- xmake/modules/package/tools/cmake.lua | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 61f49dacb..7d5550390 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -369,8 +369,9 @@ end -- get ninja function _get_ninja(package) local ninja = find_tool("ninja") - assert(ninja, "ninja not found!") - return ninja.program + if ninja then + return ninja.program + end end -- https://github.com/xmake-io/xmake-repo/pull/1096 @@ -771,10 +772,8 @@ function _get_configs_for_generator(package, configs, opt) table.insert(configs, "-G") table.insert(configs, _get_cmake_generator_for_msvc(package)) elseif package:is_plat("wasm") and is_subhost("windows") then - if not find_tool("ninja") then - table.insert(configs, "-G") - table.insert(configs, "MinGW Makefiles") - end + table.insert(configs, "-G") + table.insert(configs, "MinGW Makefiles") else table.insert(configs, "-G") table.insert(configs, "Unix Makefiles") @@ -1152,8 +1151,8 @@ function _get_cmake_generator(package, opt) if package:has_tool("cc", "clang_cl") or package:has_tool("cxx", "clang_cl") then cmake_generator = "Ninja" elseif is_subhost("windows") and package:is_plat("mingw", "wasm") then - local mingw_make = _get_mingw32_make(package) - if not mingw_make and find_tool("ninja") then + local ninja = _get_ninja(package) + if ninja then cmake_generator = "Ninja" end end -- cgit v1.3.1