yajl: add pending patch to handle CMake 4.0 support
authorChristian Marangi <[email protected]>
Tue, 11 Nov 2025 17:23:14 +0000 (18:23 +0100)
committerChristian Marangi <[email protected]>
Tue, 11 Nov 2025 17:23:14 +0000 (18:23 +0100)
Add 2 pending patch to handle CMake 4.0 support. One comes from an open
PR in the project [1]. The other is a downstream fix for trivial CMake
warning.

[1] https://github.com/lloyd/yajl/pull/256

Signed-off-by: Christian Marangi <[email protected]>
libs/yajl/patches/100-Allow-build-with-CMake-4.0.0.patch [new file with mode: 0644]
libs/yajl/patches/101-src-fix-CMake-warning-for-EXEC_COMMAND.patch [new file with mode: 0644]

diff --git a/libs/yajl/patches/100-Allow-build-with-CMake-4.0.0.patch b/libs/yajl/patches/100-Allow-build-with-CMake-4.0.0.patch
new file mode 100644 (file)
index 0000000..c086eb8
--- /dev/null
@@ -0,0 +1,60 @@
+From 8bbca6b9252c74129f3c721b0771c30ef36016fa Mon Sep 17 00:00:00 2001
+From: Rudi Heitbaum <[email protected]>
+Date: Fri, 28 Mar 2025 09:31:40 +0000
+Subject: [PATCH] Allow build with CMake 4.0.0
+
+fixes deprecated cmake option and uses cmake 2.8.0 TARGET_FILE
+update cmake supported minimum versions to 2.8.0...3.10
+
+ref:
+- https://cmake.org/cmake/help/latest/policy/CMP0026.html
+
+CMake Error at .../CMakeLists.txt: (GET_TARGET_PROPERTY):
+  The LOCATION property may not be read from target "json_...".  Use the
+  target name directly with add_custom_command, or use the generator
+  expression $<TARGET_FILE>, as appropriate.
+
+Signed-off-by: Rudi Heitbaum <[email protected]>
+---
+ CMakeLists.txt             | 2 +-
+ reformatter/CMakeLists.txt | 4 +---
+ verify/CMakeLists.txt      | 4 +---
+ 3 files changed, 3 insertions(+), 7 deletions(-)
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -12,7 +12,7 @@
+ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
++CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0...3.10)
+ PROJECT(YetAnotherJSONParser C)
+--- a/reformatter/CMakeLists.txt
++++ b/reformatter/CMakeLists.txt
+@@ -35,9 +35,7 @@ IF (NOT WIN32)
+ ENDIF (NOT WIN32)
+ # copy the binary into the output directory
+-GET_TARGET_PROPERTY(binPath json_reformat LOCATION)
+-
+ ADD_CUSTOM_COMMAND(TARGET json_reformat POST_BUILD
+-    COMMAND ${CMAKE_COMMAND} -E copy_if_different ${binPath} ${binDir})
++    COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:json_reformat> ${binDir})
+ INSTALL(TARGETS json_reformat RUNTIME DESTINATION bin)
+--- a/verify/CMakeLists.txt
++++ b/verify/CMakeLists.txt
+@@ -29,9 +29,7 @@ ADD_EXECUTABLE(json_verify ${SRCS})
+ TARGET_LINK_LIBRARIES(json_verify yajl_s)
+ # copy in the binary
+-GET_TARGET_PROPERTY(binPath json_verify LOCATION)
+-
+ ADD_CUSTOM_COMMAND(TARGET json_verify POST_BUILD
+-    COMMAND ${CMAKE_COMMAND} -E copy_if_different ${binPath} ${binDir})
++    COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:json_verify> ${binDir})
+ INSTALL(TARGETS json_verify RUNTIME DESTINATION bin)
diff --git a/libs/yajl/patches/101-src-fix-CMake-warning-for-EXEC_COMMAND.patch b/libs/yajl/patches/101-src-fix-CMake-warning-for-EXEC_COMMAND.patch
new file mode 100644 (file)
index 0000000..3a352ed
--- /dev/null
@@ -0,0 +1,39 @@
+From c3358a76eb225ccc23f6bc6d65f15580a16888f6 Mon Sep 17 00:00:00 2001
+From: Christian Marangi <[email protected]>
+Date: Tue, 11 Nov 2025 18:19:54 +0100
+Subject: [PATCH] src: fix CMake warning for EXEC_COMMAND
+
+Fix CMake warning for EXEC_COMMAND by using the modern execute_process
+and add_custom_command.
+
+Fix CMake warning:
+
+CMake Warning (dev) at src/CMakeLists.txt:70 (EXEC_PROGRAM):
+  Policy CMP0153 is not set: The exec_program command should not be called.
+  Run "cmake --help-policy CMP0153" for policy details.  Use the cmake_policy
+  command to set the policy and suppress this warning.
+
+  Use execute_process() instead.
+This warning is for project developers.  Use -Wno-dev to suppress it.
+
+Signed-off-by: Christian Marangi <[email protected]>
+---
+ src/CMakeLists.txt | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -67,9 +67,11 @@ CONFIGURE_FILE(yajl.pc.cmake ${shareDir}
+ FOREACH (header ${PUB_HDRS})
+   SET (header ${CMAKE_CURRENT_SOURCE_DIR}/${header})
+-  EXEC_PROGRAM(${CMAKE_COMMAND} ARGS -E copy_if_different ${header} ${incDir})
++  execute_process(
++    COMMAND ${CMAKE_COMMAND} -E copy_if_different ${header} ${incDir}
++  )
+-  ADD_CUSTOM_COMMAND(TARGET yajl_s POST_BUILD
++  add_custom_command(TARGET yajl_s POST_BUILD
+       COMMAND ${CMAKE_COMMAND} -E copy_if_different ${header} ${incDir})
+ ENDFOREACH (header ${PUB_HDRS})