From a9815125c97acfb5d587232e0bdc475675f804bf Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 21 Jul 2025 22:30:34 +0800 Subject: improve tools/cmake --- xmake/modules/package/tools/cmake.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- cgit v1.3.1