Skip to contentSkip to conversation

Add CMake 4 support to cjson and flatcc

PATCH Applied Benoît Monin via buildroot 1 participant 6 messages Jul 29, 2025 – Aug 14, 2025

lore
Share & tools
lore
#0 lore raw

v2 cover Add CMake 4 support to cjson and flatcc

Increase the minimum version of CMake to 3.5 in the CMakeLists.txt of both packages to add support for CMake 4.x.
Both patches come from github PR that are still open at the time of posting this message.

---
Changes in v2:
- Add my Signed-off-by to the patches
- Properly send the patches to buildroot ml
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Benoît Monin (2):
package/cjson: fix cmake 4 compatibility
package/flatcc: fix cmake 4 compatibility

 .../0001-make_compatible_with_cmake_4.0.patch      | 34 +++++++++++++++
 ...nimum_required_version_to_3.5_for_cmake_4.patch | 51 ++++++++++++++++++++++
 2 files changed, 85 insertions(+)

---
base-commit: 065c1b84b56c144c1cb8f2af1069de96d83b03c7
change-id: 20250725-cmake4-b295cebf812d

Best regards,

Signature · 8 lines
Benoît Monin, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

PATCH v2 1/2 package/cjson: fix cmake 4 compatibility

Add a patch fixing cmake 4 compatibility, found in upstream pull request #935.

---
 .../0001-make_compatible_with_cmake_4.0.patch      | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)
package/cjson/0001-make_compatible_with_cmake_4.0.patch new file +34 -0
new file mode 100644
index 0000000000000000000000000000000000000000..1fe5cd43ef10de366c281c888059d8e674e53d2a
@@ -0,0 +1,34 @@
+From 58bc7c823c2e39f1a626ec4da86952bc6819bd6b Mon Sep 17 00:00:00 2001
+From: Markus Vieth <[email protected]>
+Date: Sun, 30 Mar 2025 11:12:07 +0200
+Subject: [PATCH] Make compatible with CMake 4.0 When trying to build with
+ CMake 4.0, the following error is shown:
+
+CMake Error at CMakeLists.txt:2 (cmake_minimum_required):
+  Compatibility with CMake < 3.5 has been removed from CMake.
+
+  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
+  to tell CMake that the project requires at least <min> but has been updated
+  to work with policies introduced by <max> or earlier.
+
+  Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.
+
+This change raises the minimum required CMake version to 3.5 and thus makes the project compatible with CMake 4.0
+
+Signed-off-by: Benoît Monin <[email protected]>
+Upstream: https://github.com/DaveGamble/cJSON/pull/935
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 36a6cb57..9428da58 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,5 +1,5 @@
+ set(CMAKE_LEGACY_CYGWIN_WIN32 0)
+-cmake_minimum_required(VERSION 3.0)
++cmake_minimum_required(VERSION 3.5)
+ 
+ project(cJSON
+     VERSION 1.7.18
Signature · 6 lines
2.50.1

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

Re: [Buildroot] [PATCH v2 1/2] package/cjson: fix cmake 4 compatibility

Hello Benoît, All,

Le 29/07/2025 à 11:21, Benoît Monin via buildroot a écrit :

Quoted 2 lines

Add a patch fixing cmake 4 compatibility, found in upstream pull request #935.

I added link to autobuilder failures in commit log since we have at least one autobuilder using cmake 4.x:

https://autobuild.buildroot.org/?submitter=James+Hilliard+%28arch-upstream-data-7960x%29

I haven't found any issue for flatcc.

Note: cmake 4.x is not yet used by many Linux distribution (not even the upcoming Fedora 43):
https://repology.org/project/cmake/versions

Series applied to master, thanks.

Best regards,
Romain

Quoted 37 lines
---
 .../0001-make_compatible_with_cmake_4.0.patch      | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)
package/cjson/0001-make_compatible_with_cmake_4.0.patch new file +24 -0
new file mode 100644
index 0000000000000000000000000000000000000000..1fe5cd43ef10de366c281c888059d8e674e53d2a
@@ -0,0 +1,34 @@
+From 58bc7c823c2e39f1a626ec4da86952bc6819bd6b Mon Sep 17 00:00:00 2001
+From: Markus Vieth <[email protected]>
+Date: Sun, 30 Mar 2025 11:12:07 +0200
+Subject: [PATCH] Make compatible with CMake 4.0 When trying to build with
+ CMake 4.0, the following error is shown:
+
+CMake Error at CMakeLists.txt:2 (cmake_minimum_required):
+  Compatibility with CMake < 3.5 has been removed from CMake.
+
+  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
+  to tell CMake that the project requires at least <min> but has been updated
+  to work with policies introduced by <max> or earlier.
+
+  Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.
+
+This change raises the minimum required CMake version to 3.5 and thus makes the project compatible with CMake 4.0
+
+Signed-off-by: Benoît Monin <[email protected]>
+Upstream: https://github.com/DaveGamble/cJSON/pull/935
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt

package/cjson/0001-make_compatible_with_cmake_4.0.patch line 34

Quoted 10 lines
package/cjson/0001-make_compatible_with_cmake_4.0.patch new file +10 -0
+index 36a6cb57..9428da58 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,5 +1,5 @@
+ set(CMAKE_LEGACY_CYGWIN_WIN32 0)
+-cmake_minimum_required(VERSION 3.0)
++cmake_minimum_required(VERSION 3.5)
+ 
+ project(cJSON
+     VERSION 1.7.18

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

#3 lore raw

Re: [Buildroot] [PATCH v2 1/2] package/cjson: fix cmake 4 compatibility

In reply to Benoît Monin via buildroot

In reply of:

Quoted 4 lines

Add a patch fixing cmake 4 compatibility, found in upstream pull request #935.

Applied to 2025.05.x. Thanks

Quoted 52 lines
---
 .../0001-make_compatible_with_cmake_4.0.patch      | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)
package/cjson/0001-make_compatible_with_cmake_4.0.patch new file +34 -0
new file mode 100644
index 0000000000000000000000000000000000000000..1fe5cd43ef10de366c281c888059d8e674e53d2a
@@ -0,0 +1,34 @@
+From 58bc7c823c2e39f1a626ec4da86952bc6819bd6b Mon Sep 17 00:00:00 2001
+From: Markus Vieth <[email protected]>
+Date: Sun, 30 Mar 2025 11:12:07 +0200
+Subject: [PATCH] Make compatible with CMake 4.0 When trying to build with
+ CMake 4.0, the following error is shown:
+
+CMake Error at CMakeLists.txt:2 (cmake_minimum_required):
+  Compatibility with CMake < 3.5 has been removed from CMake.
+
+  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
+  to tell CMake that the project requires at least <min> but has been updated
+  to work with policies introduced by <max> or earlier.
+
+  Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.
+
+This change raises the minimum required CMake version to 3.5 and thus makes the project compatible with CMake 4.0
+
+Signed-off-by: Benoît Monin <[email protected]>
+Upstream: https://github.com/DaveGamble/cJSON/pull/935
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 36a6cb57..9428da58 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,5 +1,5 @@
+ set(CMAKE_LEGACY_CYGWIN_WIN32 0)
+-cmake_minimum_required(VERSION 3.0)
++cmake_minimum_required(VERSION 3.5)
+ 
+ project(cJSON
+     VERSION 1.7.18
Signature · 7 lines
-- 
2.50.1

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

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

#4 lore raw

PATCH v2 2/2 package/flatcc: fix cmake 4 compatibility

In reply to Benoît Monin via buildroot

Add a patch fixing cmake 4 compatibility, found in upstream pull request #349. The patch has been modified to apply on version 0.6.1 instead of the current upstream HEAD.

---
 ...nimum_required_version_to_3.5_for_cmake_4.patch | 51 ++++++++++++++++++++++
 1 file changed, 51 insertions(+)
package/flatcc/0001-cmake_set_minimum_required_version_to_3.5_for_cmake_4.patch new file +51 -0
new file mode 100644
index 0000000000000000000000000000000000000000..9bfae54ae2ac643c34599269e17b3c99f51ce082
@@ -0,0 +1,51 @@
+From 915f62dcd9f0a372944f749cf4acd707db10c5fd Mon Sep 17 00:00:00 2001
+From: Alper Ak <[email protected]>
+Date: Wed, 9 Jul 2025 12:59:17 +0300
+Subject: [PATCH] cmake: Set minimum required version to 3.5 for CMake 4+
+ compatibility
+
+Fix:
+
+| CMake Error at CMakeLists.txt:2 (cmake_minimum_required):
+|   Compatibility with CMake < 3.5 has been removed from CMake.
+|
+|   Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
+|   to tell CMake that the project requires at least <min> but has been updated
+|   to work with policies introduced by <max> or earlier.
+|
+|   Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.
+|
+|
+| -- Configuring incomplete, errors occurred!
+
+Signed-off-by: Alper Ak <[email protected]>
+Signed-off-by: Benoît Monin <[email protected]>
+Upstream: https://github.com/dvidelabs/flatcc/pull/349
+---
+ CMakeLists.txt               | 2 +-
+ external/hash/CMakeLists.txt | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d4127f598..b51e5c5bd 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -2,7 +2,7 @@
+ #cmake_minimum_required (VERSION 2.8.12.2)
+ # Centos 7
+ #cmake_minimum_required (VERSION 2.8.11)
+-cmake_minimum_required (VERSION 2.8)
++cmake_minimum_required (VERSION 3.5)
+ 
+ # Disable build of tests and samples. Due to custom build step
+ # dependency on flatcc tool, some custom build configurations may
+diff --git a/external/hash/CMakeLists.txt b/external/hash/CMakeLists.txt
+index 7b7d990dd..12eb3daa4 100644
+--- a/external/hash/CMakeLists.txt
++++ b/external/hash/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-cmake_minimum_required (VERSION 3.0.2)
++cmake_minimum_required (VERSION 3.5)
+ 
+ project (HashTest)
+ 
Signature · 6 lines
2.50.1

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

Re: [Buildroot] [PATCH v2 2/2] package/flatcc: fix cmake 4 compatibility

In reply of:

Quoted 5 lines

Add a patch fixing cmake 4 compatibility, found in upstream pull request #349. The patch has been modified to apply on version 0.6.1 instead of the current upstream HEAD.

Applied to 2025.05.x. Thanks

Quoted 69 lines
---
 ...nimum_required_version_to_3.5_for_cmake_4.patch | 51 ++++++++++++++++++++++
 1 file changed, 51 insertions(+)
package/flatcc/0001-cmake_set_minimum_required_version_to_3.5_for_cmake_4.patch new file +51 -0
new file mode 100644
index 0000000000000000000000000000000000000000..9bfae54ae2ac643c34599269e17b3c99f51ce082
@@ -0,0 +1,51 @@
+From 915f62dcd9f0a372944f749cf4acd707db10c5fd Mon Sep 17 00:00:00 2001
+From: Alper Ak <[email protected]>
+Date: Wed, 9 Jul 2025 12:59:17 +0300
+Subject: [PATCH] cmake: Set minimum required version to 3.5 for CMake 4+
+ compatibility
+
+Fix:
+
+| CMake Error at CMakeLists.txt:2 (cmake_minimum_required):
+|   Compatibility with CMake < 3.5 has been removed from CMake.
+|
+|   Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
+|   to tell CMake that the project requires at least <min> but has been updated
+|   to work with policies introduced by <max> or earlier.
+|
+|   Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.
+|
+|
+| -- Configuring incomplete, errors occurred!
+
+Signed-off-by: Alper Ak <[email protected]>
+Signed-off-by: Benoît Monin <[email protected]>
+Upstream: https://github.com/dvidelabs/flatcc/pull/349
+---
+ CMakeLists.txt               | 2 +-
+ external/hash/CMakeLists.txt | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d4127f598..b51e5c5bd 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -2,7 +2,7 @@
+ #cmake_minimum_required (VERSION 2.8.12.2)
+ # Centos 7
+ #cmake_minimum_required (VERSION 2.8.11)
+-cmake_minimum_required (VERSION 2.8)
++cmake_minimum_required (VERSION 3.5)
+ 
+ # Disable build of tests and samples. Due to custom build step
+ # dependency on flatcc tool, some custom build configurations may
+diff --git a/external/hash/CMakeLists.txt b/external/hash/CMakeLists.txt
+index 7b7d990dd..12eb3daa4 100644
+--- a/external/hash/CMakeLists.txt
++++ b/external/hash/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-cmake_minimum_required (VERSION 3.0.2)
++cmake_minimum_required (VERSION 3.5)
+ 
+ project (HashTest)
+ 
Signature · 7 lines
-- 
2.50.1

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

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