summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-11-14 21:28:51 +0800
committerruki <[email protected]>2020-11-14 21:28:51 +0800
commite8dae90dac349d00b9693057454a643d31edabd6 (patch)
treeebe431b5766f1ebbaeac89cff9c148aca8cd66d0
parentf47594357eb354d927e7c717bf03f5d48493ddea (diff)
improve cmake build
-rw-r--r--xmake/modules/package/tools/cmake.lua8
-rw-r--r--xmake/modules/private/action/trybuild/cmake.lua6
2 files changed, 10 insertions, 4 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 77a204e8b..88f0df71b 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -35,9 +35,13 @@ end
-- get configs for windows
function _get_configs_for_windows(package, configs, opt)
local cmake_generator = opt.cmake_generator
- if package:is_arch("x64") and (not cmake_generator or cmake_generator:find("Visual Studio", 1, true)) then
+ if not cmake_generator or cmake_generator:find("Visual Studio", 1, true) then
table.insert(configs, "-A")
- table.insert(configs, "x64")
+ if package:is_arch("x86", "i386") then
+ table.insert(configs, "Win32")
+ else
+ table.insert(configs, "x64")
+ end
end
local vs_runtime = package:config("vs_runtime")
if vs_runtime then
diff --git a/xmake/modules/private/action/trybuild/cmake.lua b/xmake/modules/private/action/trybuild/cmake.lua
index fd20d6308..3af44ef51 100644
--- a/xmake/modules/private/action/trybuild/cmake.lua
+++ b/xmake/modules/private/action/trybuild/cmake.lua
@@ -51,8 +51,10 @@ end
-- get configs for windows
function _get_configs_for_windows(configs)
- if is_arch("x64") then
- table.insert(configs, "-A")
+ table.insert(configs, "-A")
+ if is_arch("x86", "i386") then
+ table.insert(configs, "Win32")
+ else
table.insert(configs, "x64")
end
end