浏览代码

support/dependencies/check-host-cmake.mk: set host-cmake max version

Since the introduction of CMake 4 in several distributions, build errors
started occurring on those distributions for cmake packages that
included calls to cmake_minimum_required() or cmake_policy() with a
version older than 3.50 (see [1]).

To avoid backporting numerous individual fixes for affected packages,
commit [2] was previously applied to the LTS branch as a workaround.

Following further discussion (see [2][3]), that raised concerns about
policy changes between CMake versions that could lead to breaking builds
in non-obvious ways, a different approach was chosen.

This patch reverts commit [2] and instead of applying a global
compatibility variable, we now enforce building host-cmake when the host
system provides CMake 4 or newer.

[1] https://cmake.org/cmake/help/latest/release/4.0.html#deprecated-and-removed-features
[2] 70aac2d9e8 package/pkg-cmake.mk: force config version >=3.5
[3] https://lists.buildroot.org/pipermail/buildroot/2025-May/780262.html
[4] https://lists.buildroot.org/pipermail/buildroot/2025-June/780372.html

Signed-off-by: Thomas Perale <thomas.perale@mind.be>
Thomas Perale 1 月之前
父节点
当前提交
946b7ff228
共有 2 个文件被更改,包括 9 次插入4 次删除
  1. 0 4
      package/pkg-cmake.mk
  2. 9 0
      support/dependencies/check-host-cmake.sh

+ 0 - 4
package/pkg-cmake.mk

@@ -53,10 +53,6 @@ define inner-cmake-package
 
 $(3)_SUPPORTS_IN_SOURCE_BUILD ?= YES
 
-# Some packages requires CMake 3.0.0 but latest CMake requires >=3.5
-# Set the policy version minimum to force these packages to 3.5 or greater.
-$(2)_CONF_OPTS += -DCMAKE_POLICY_VERSION_MINIMUM=3.5
-
 # The default backend, unless specified by the package
 $(3)_CMAKE_BACKEND ?= make
 

+ 9 - 0
support/dependencies/check-host-cmake.sh

@@ -6,6 +6,9 @@
 major_min="${1%.*}"
 minor_min="${1#*.}"
 
+major_max="4"
+minor_max="0"
+
 shift
 
 for candidate; do
@@ -32,6 +35,12 @@ for candidate; do
     major="${version%.*}"
     minor="${version#*.}"
 
+    if [ ${major} -gt ${major_max} ]; then
+        continue
+    elif [ ${major} -eq ${major_max} -a ${minor} -ge ${minor_max} ]; then
+        continue
+    fi
+
     if [ ${major} -gt ${major_min} ]; then
         echo "${cmake}"
         exit