summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-04-03 22:40:45 +0800
committerruki <[email protected]>2025-04-03 22:40:45 +0800
commit935789fc065c1095802e49d9999f0a8d5308c567 (patch)
treef4a0b8b8fe28e9341f75fc376cf42eed580d7257
parentb7fe536c3356e63933f675b35111e9760769e3c7 (diff)
fix cmake 4.x error
-rw-r--r--xmake/modules/package/tools/cmake.lua12
1 files changed, 7 insertions, 5 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 90f756591..c1eed339a 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -427,11 +427,6 @@ function _get_configs_for_generic(package, configs, opt)
if not package:use_external_includes() then
table.insert(configs, "-DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON")
end
- -- fix error for cmake 4.x
- -- e.g. Compatibility with CMake < 3.5 has been removed from CMake.
- if _get_cmake_version() and _get_cmake_version():ge("4.0") then
- table.insert(configs, "-DCMAKE_POLICY_VERSION_MINIMUM=3.5")
- end
end
-- get configs for windows
@@ -950,6 +945,13 @@ function _get_configs(package, configs, opt)
else
_get_configs_for_generic(package, configs, opt)
end
+
+ -- fix error for cmake 4.x
+ -- e.g. Compatibility with CMake < 3.5 has been removed from CMake.
+ if _get_cmake_version() and _get_cmake_version():ge("4.0") then
+ 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