diff mbox series

[meta-oe] jsonrpc: Allow to build with CMake 4+

Message ID 20250711131552.303728-1-Moritz.Haase@bmw.de
State Under Review
Headers show
Series [meta-oe] jsonrpc: Allow to build with CMake 4+ | expand

Commit Message

Moritz Haase July 11, 2025, 1:15 p.m. UTC
Upstream is inactive, so use the 'minimum policy version' override. An
additional patch is required to remove usage of an outdated policy that only
affects MacOS however, so we should we fine.

Signed-off-by: Moritz Haase <Moritz.Haase@bmw.de>
---
 ...-usage-of-obsolete-MacOS-only-policy.patch | 38 +++++++++++++++++++
 .../recipes-devtools/jsonrpc/jsonrpc_1.4.1.bb |  5 ++-
 2 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-devtools/jsonrpc/jsonrpc/0001-cmake-Remove-usage-of-obsolete-MacOS-only-policy.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/jsonrpc/jsonrpc/0001-cmake-Remove-usage-of-obsolete-MacOS-only-policy.patch b/meta-oe/recipes-devtools/jsonrpc/jsonrpc/0001-cmake-Remove-usage-of-obsolete-MacOS-only-policy.patch
new file mode 100644
index 0000000000..ef0c12722f
--- /dev/null
+++ b/meta-oe/recipes-devtools/jsonrpc/jsonrpc/0001-cmake-Remove-usage-of-obsolete-MacOS-only-policy.patch
@@ -0,0 +1,38 @@ 
+From 7cc415c5b2406b16adcccdce3fc8bf5223a1bdb1 Mon Sep 17 00:00:00 2001
+From: Moritz Haase <Moritz.Haase@bmw.de>
+Date: Fri, 11 Jul 2025 12:31:49 +0200
+Subject: [PATCH] cmake: Remove usage of obsolete MacOS-only policy
+
+Workaround an error reported by CMake 4 that only affects MacOS.
+
+CMake Error at CMakeLists.txt:21 (cmake_policy):
+  Policy CMP0042 may not be set to OLD behavior because this version of CMake
+  no longer supports it.  The policy was introduced in CMake version 3.0.0,
+  and use of NEW behavior is now required.
+
+  Please either update your CMakeLists.txt files to conform to the new
+  behavior or use an older version of CMake that still supports the old
+  behavior.  Run cmake --help-policy CMP0042 for more information.
+
+Upstream-Status: Inactive-Upstream [2022-01-12]
+Signed-off-by: Moritz Haase <Moritz.Haase@bmw.de>
+---
+ CMakeLists.txt | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 961e55a..909610b 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -16,11 +16,6 @@ project(libjson-rpc-cpp)
+ cmake_policy(SET CMP0007 NEW)
+ cmake_policy(SET CMP0012 NEW)
+ 
+-if (${CMAKE_MAJOR_VERSION} GREATER 2)
+-    # old policy do not use MACOSX_RPATH
+-    cmake_policy(SET CMP0042 OLD)
+-endif()
+-
+ set(MAJOR_VERSION 1)
+ set(MINOR_VERSION 4)
+ set(PATCH_VERSION 1)
diff --git a/meta-oe/recipes-devtools/jsonrpc/jsonrpc_1.4.1.bb b/meta-oe/recipes-devtools/jsonrpc/jsonrpc_1.4.1.bb
index ae86e20a4a..18a8904015 100644
--- a/meta-oe/recipes-devtools/jsonrpc/jsonrpc_1.4.1.bb
+++ b/meta-oe/recipes-devtools/jsonrpc/jsonrpc_1.4.1.bb
@@ -9,7 +9,9 @@  SECTION = "libs"
 
 DEPENDS = "curl jsoncpp libmicrohttpd hiredis"
 
-SRC_URI = "git://github.com/cinemast/libjson-rpc-cpp;branch=master;protocol=https"
+SRC_URI = "git://github.com/cinemast/libjson-rpc-cpp;branch=master;protocol=https \
+           file://0001-cmake-Remove-usage-of-obsolete-MacOS-only-policy.patch \
+           "
 
 SRCREV = "ec5ce12fc9c0299e1454cc002c70218b5a6f005b"
 
@@ -22,6 +24,7 @@  inherit cmake
 EXTRA_OECMAKE += "-DCOMPILE_TESTS=NO -DCOMPILE_STUBGEN=NO -DCOMPILE_EXAMPLES=NO \
                   -DBUILD_SHARED_LIBS=YES -DBUILD_STATIC_LIBS=YES \
                   -DCMAKE_LIBRARY_PATH=${libdir} \
+                  -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
 "
 
 do_install:append() {