From ec46b858be4de1a09802ced44ea8e2860edd093a Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 14 Sep 2025 21:25:43 +0800 Subject: fix cmake flags #6781 --- xmake/modules/package/tools/cmake.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index cbf9bcb37..86754f13c 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -941,6 +941,11 @@ end function _get_configs(package, configs, opt) configs = configs or {} opt._configs_str = string.serialize(configs, {indent = false, strip = true}) + + -- we need to get the default flags first to avoid being overwritten. + -- @see https://github.com/xmake-io/xmake/issues/6781 + local envs = _get_envs_for_default_flags(package, configs, opt) + _get_configs_for_install(package, configs, opt) _get_configs_for_generator(package, configs, opt) if package:is_plat("windows") then @@ -975,7 +980,6 @@ function _get_configs(package, configs, opt) table.insert(configs, "-DCMAKE_POLICY_VERSION_MINIMUM=3.5") end - local envs = _get_envs_for_default_flags(package, configs, opt) local runtime_envs = _get_envs_for_runtime_flags(package, configs, opt) if runtime_envs then envs = envs or {} -- cgit v1.3.1