summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-07-21 22:30:34 +0800
committerruki <[email protected]>2025-07-21 22:30:34 +0800
commita9815125c97acfb5d587232e0bdc475675f804bf (patch)
treece74e3e4210a1a6edbc54d6405f26d58fd4da436
parentee6ee5375f25d968f9299af995254973db43e44b (diff)
improve tools/cmake
-rw-r--r--xmake/modules/package/tools/cmake.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 67b4da572..75912612a 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -458,12 +458,15 @@ function _get_configs_for_windows(package, configs, opt)
end
end
- -- use clang-cl or clang
+ -- use clang-cl or clang, and we need pass --target=xxx flags
if package:has_tool("cc", "clang", "clang_cl") then
envs.CMAKE_C_COMPILER = _translate_bin_path(package:build_getenv("cc"))
+ -- @see https://github.com/xmake-io/xmake-repo/issues/7662
+ envs.CMAKE_C_FLAGS = table.join(package:build_getenv("cflags") or {}, package:build_getenv("cxflags"))
end
if package:has_tool("cxx", "clang", "clang_cl") then
envs.CMAKE_CXX_COMPILER = _translate_bin_path(package:build_getenv("cxx"))
+ envs.CMAKE_CXX_FLAGS = table.join(package:build_getenv("cxxflags") or {}, package:build_getenv("cxflags"))
end
-- we maybe need patch `cmake_policy(SET CMP0091 NEW)` to enable this argument for some packages