diff options
| -rw-r--r-- | xmake/modules/detect/tools/find_cmake.lua | 10 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_ninja.lua | 10 | ||||
| -rw-r--r-- | xmake/toolchains/msvc/check.lua | 2 |
3 files changed, 13 insertions, 9 deletions
diff --git a/xmake/modules/detect/tools/find_cmake.lua b/xmake/modules/detect/tools/find_cmake.lua index 145a439e9..f0bb40813 100644 --- a/xmake/modules/detect/tools/find_cmake.lua +++ b/xmake/modules/detect/tools/find_cmake.lua @@ -42,15 +42,19 @@ function main(opt) opt = opt or {} if is_host("windows") then opt.paths = "$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Kitware\\CMake;InstallDir)\\bin" + end + + -- find program + local program = find_program(opt.program or "cmake", opt) + if not program and is_host("windows") then local msvc = toolchain.load("msvc") if msvc:check() then opt.envs = toolchain.load("msvc"):runenvs() -- we attempt to find it from vstudio environments + opt.force = true + program = find_program(opt.program or "cmake", opt) end end - -- find program - local program = find_program(opt.program or "cmake", opt) - -- find program version local version = nil if program and opt and opt.version then diff --git a/xmake/modules/detect/tools/find_ninja.lua b/xmake/modules/detect/tools/find_ninja.lua index 055939497..797cec264 100644 --- a/xmake/modules/detect/tools/find_ninja.lua +++ b/xmake/modules/detect/tools/find_ninja.lua @@ -38,18 +38,18 @@ import("core.tool.toolchain") -- function main(opt) - -- init options + -- find program opt = opt or {} - if is_host("windows") then + local program = find_program(opt.program or "ninja", opt) + if not program and is_host("windows") then local msvc = toolchain.load("msvc") if msvc:check() then opt.envs = toolchain.load("msvc"):runenvs() -- we attempt to find it from vstudio environments + opt.force = true + program = find_program(opt.program or "ninja", opt) end end - -- find program - local program = find_program(opt.program or "ninja", opt) - -- find program version local version = nil if program and opt and opt.version then diff --git a/xmake/toolchains/msvc/check.lua b/xmake/toolchains/msvc/check.lua index 52109b76a..33cfc6298 100644 --- a/xmake/toolchains/msvc/check.lua +++ b/xmake/toolchains/msvc/check.lua @@ -80,7 +80,7 @@ function _check_vstudio(toolchain) cprint("checking for Microsoft Visual Studio (%s) version ... ${color.success}%s", toolchain:arch(), vs) else cprint("checking for Microsoft Visual Studio (%s) version ... ${color.nothing}${text.nothing}", toolchain:arch()) - if not (opt and opt.try) then + if toolchain:is_plat("windows") then print("please run:") print(" - xmake config --vs=xxx [--vs_toolset=xxx]") print("or - xmake global --vs=xxx") |
