jsonrpc: Allow to build with CMake 4+

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>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Moritz Haase 2025-07-11 15:15:52 +02:00 committed by Khem Raj
parent 90e240756c
commit b7a6d63835
No known key found for this signature in database
GPG Key ID: BB053355919D3314
2 changed files with 42 additions and 1 deletions

View File

@ -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)

View File

@ -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() {