Skip to contentSkip to conversation

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

PATCH Applied Thomas Perale via buildroot 1 participant 3 messages Jan 26 – Feb 19

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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]).

This patch 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

---
 support/dependencies/check-host-cmake.sh | 9 +++++++++
 1 file changed, 9 insertions(+)
support/dependencies/check-host-cmake.sh +9 -0
index fadeae9f6b..c7aa16f48d 100755
@@ -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
Signature · 6 lines
2.52.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hi Thomas,

Thanks for the patch.

I agree with this change. I also suggest to add in the commit log a bit more information to give examples of which distributions switched to cmake 4, and also to to explicitly say this patch is explicitly meant for LTS branches only, and to explain why we don't want to apply such a patch on master. See my suggestions below.

Quoted 1 line · Thomas Perale via buildroot

Since the introduction of CMake 4 in several distributions

(such as Alpine [1] and Arch [2] Linux)

Quoted 4 lines

,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]).

                     ~~~~

Should this be "3.5"?

Quoted 2 lines

This patch enforce building host-cmake when the host system provides CMake 4 or newer.

I suggest to add here:
"""
Note: this patch is only meant for LTS maintenance branches in which the host-cmake was kept to a version less than 4.x. This is to avoid too many unnecessary package updates and patches. We also prefer not to apply it on the main master branch to make sure Buildroot packages will get updated or removed (if deprecated).
"""

Quoted 3 lines

[1] https://cmake.org/cmake/help/latest/release/4.0.html#deprecated-and-removed-features

Best regards,

Julien.

[1] https://gitlab.alpinelinux.org/alpine/aports/-/commit/21fe3cb10d65862648a7a65cc258899bfcae9b11
[2] https://gitlab.archlinux.org/archlinux/packaging/packages/cmake/-/commit/b634e8ded6d2d887450586f14f404f72518b97b9
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
In reply to Thomas Perale via buildroot

In reply of:

Quoted 11 lines

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]).

This patch 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

Applied to 2025.11.x. Thanks

Quoted 38 lines
---
 support/dependencies/check-host-cmake.sh | 9 +++++++++
 1 file changed, 9 insertions(+)
support/dependencies/check-host-cmake.sh +9 -0
index fadeae9f6b..c7aa16f48d 100755
@@ -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
Signature · 6 lines
2.52.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot