From 7a7b1aa4b45d455b9594f7768ff4092fbd0cc2f0 Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 9 Oct 2023 23:50:23 +0800 Subject: improve trybuild/cmake --- xmake/modules/private/action/trybuild/cmake.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xmake/modules/private/action/trybuild/cmake.lua b/xmake/modules/private/action/trybuild/cmake.lua index 4e9729108..b600f3ef6 100644 --- a/xmake/modules/private/action/trybuild/cmake.lua +++ b/xmake/modules/private/action/trybuild/cmake.lua @@ -102,7 +102,12 @@ function _is_cross_compilation() end -- get configs for windows -function _get_configs_for_windows(configs) +function _get_configs_for_windows(configs, opt) + opt = opt or {} + local cmake_generator = opt.cmake_generator + if cmake_generator and not cmake_generator:find("Visual Studio", 1, true) then + return + end table.insert(configs, "-A") if is_arch("x86", "i386") then table.insert(configs, "Win32") @@ -377,7 +382,7 @@ function _get_configs(opt) _get_configs_for_install(configs, opt) _get_configs_for_generator(configs, opt) if is_plat("windows") then - _get_configs_for_windows(configs) + _get_configs_for_windows(configs, opt) elseif is_plat("android") then _get_configs_for_android(configs) elseif is_plat("iphoneos", "watchos") or -- cgit v1.3.1