diff mbox series

[meta-openembedded,03/20] cjson: Add patch for CMake 4+ compatibility

Message ID 20250708195636.1678606-3-alperyasinak1@gmail.com
State New
Headers show
Series [meta-openembedded,01/20] cannelloni: Upgrade 1.1.0 -> 2.0.0 to allow CMake 4+ compatibility | expand

Commit Message

Alper Ak July 8, 2025, 7:56 p.m. UTC
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 <alperyasinak1@gmail.com>
---
 .../cjson/0001-allow-build-with-cmake-4.patch | 41 +++++++++++++++++++
 .../recipes-devtools/cjson/cjson_1.7.18.bb    |  2 +-
 2 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-devtools/cjson/cjson/0001-allow-build-with-cmake-4.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/cjson/cjson/0001-allow-build-with-cmake-4.patch b/meta-oe/recipes-devtools/cjson/cjson/0001-allow-build-with-cmake-4.patch
new file mode 100644
index 0000000000..7bd608ca0a
--- /dev/null
+++ b/meta-oe/recipes-devtools/cjson/cjson/0001-allow-build-with-cmake-4.patch
@@ -0,0 +1,41 @@ 
+From 8622490d650ba4d107561a0e8f3cf881fa0247c7 Mon Sep 17 00:00:00 2001
+From: Alper Ak <alperyasinak1@gmail.com>
+Date: Tue, 8 Jul 2025 15:09:11 +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!
+
+Upstream-Status: Submitted [https://github.com/DaveGamble/cJSON/pull/935]
+
+Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 36a6cb5..9428da5 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
+-- 
+2.43.0
+
diff --git a/meta-oe/recipes-devtools/cjson/cjson_1.7.18.bb b/meta-oe/recipes-devtools/cjson/cjson_1.7.18.bb
index 33c8c28531..7ece0065ba 100644
--- a/meta-oe/recipes-devtools/cjson/cjson_1.7.18.bb
+++ b/meta-oe/recipes-devtools/cjson/cjson_1.7.18.bb
@@ -6,10 +6,10 @@  LIC_FILES_CHKSUM = "file://LICENSE;md5=218947f77e8cb8e2fa02918dc41c50d0"
 
 SRC_URI = "git://github.com/DaveGamble/cJSON.git;branch=master;protocol=https \
            file://run-ptest \
+           file://0001-allow-build-with-cmake-4.patch \
          "
 SRCREV = "acc76239bee01d8e9c858ae2cab296704e52d916"
 
-
 inherit cmake pkgconfig ptest
 
 RDEPENDS:${PN}-ptest += "cmake"