summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-03-02 23:13:59 +0800
committerruki <[email protected]>2023-03-02 23:13:59 +0800
commitd451f16665a8230ec8c730cb67911f1e8a767fdb (patch)
tree14431afb91e2602a41b1647e2f6b5032ea5c228a
parent5afbc8e9f237b3c782b75183c11ca5b2ed41e661 (diff)
improve find_cmake
-rw-r--r--xmake/modules/detect/tools/find_cmake.lua3
-rw-r--r--xmake/modules/detect/tools/find_devenv.lua2
-rw-r--r--xmake/modules/detect/tools/find_ninja.lua2
3 files changed, 4 insertions, 3 deletions
diff --git a/xmake/modules/detect/tools/find_cmake.lua b/xmake/modules/detect/tools/find_cmake.lua
index 7c967f600..dd787047a 100644
--- a/xmake/modules/detect/tools/find_cmake.lua
+++ b/xmake/modules/detect/tools/find_cmake.lua
@@ -47,7 +47,8 @@ function main(opt)
-- find program
local program = find_program(opt.program or "cmake", opt)
if not program and is_host("windows") then
- local msvc = toolchain.load("msvc")
+ -- we always use host/arch to avoid windows/arm64, because we are building packages for cross-compilation
+ local msvc = toolchain.load("msvc", {plat = os.host(), arch = os.arch()})
if msvc:check() then
opt.envs = msvc:runenvs() -- we attempt to find it from vstudio environments
opt.force = true
diff --git a/xmake/modules/detect/tools/find_devenv.lua b/xmake/modules/detect/tools/find_devenv.lua
index c0d56f42a..ad3f3aaf3 100644
--- a/xmake/modules/detect/tools/find_devenv.lua
+++ b/xmake/modules/detect/tools/find_devenv.lua
@@ -49,7 +49,7 @@ function main(opt)
-- e.g. C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
--
local program = nil
- local msvc = toolchain.load("msvc")
+ local msvc = toolchain.load("msvc", {plat = os.host(), arch = os.arch()})
if msvc then
local vcvars = msvc:config("vcvars")
if vcvars then
diff --git a/xmake/modules/detect/tools/find_ninja.lua b/xmake/modules/detect/tools/find_ninja.lua
index 36b8b0db8..297784d69 100644
--- a/xmake/modules/detect/tools/find_ninja.lua
+++ b/xmake/modules/detect/tools/find_ninja.lua
@@ -42,7 +42,7 @@ function main(opt)
opt = opt or {}
local program = find_program(opt.program or "ninja", opt)
if not program and is_host("windows") then
- local msvc = toolchain.load("msvc")
+ local msvc = toolchain.load("msvc", {plat = os.host(), arch = os.arch()})
if msvc:check() then
opt.envs = msvc:runenvs() -- we attempt to find it from vstudio environments
opt.force = true