From 40dd3e9cc14432632f48f00ba687cd485a82b0e5 Mon Sep 17 00:00:00 2001 From: Alper Ak Date: Thu, 10 Jul 2025 00:11:12 +0300 Subject: yajl: Add patch for CMake 4+ compatibility and fix build issue - CMake 3.0 and newer disallow reading the LOCATION property of targets directly. Instead, use the recommended $ generator expression when referencing the output binary in add_custom_command. Fixes: | CMake Error at CMakeLists.txt:15 (CMAKE_MINIMUM_REQUIRED): | Compatibility with CMake < 3.5 has been removed from CMake. | | Update the VERSION argument value. Or, use the ... syntax | to tell CMake that the project requires at least but has been updated | to work with policies introduced by or earlier. | | Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway. | | | -- Configuring incomplete, errors occurred! ----- | CMake Error at reformatter/CMakeLists.txt:38 (GET_TARGET_PROPERTY): | The LOCATION property may not be read from target "json_reformat". Use the | target name directly with add_custom_command, or use the generator | expression $, as appropriate. | | | | CMake Error at verify/CMakeLists.txt:32 (GET_TARGET_PROPERTY): | The LOCATION property may not be read from target "json_verify". Use the | target name directly with add_custom_command, or use the generator | expression $, as appropriate. Signed-off-by: Alper Ak Signed-off-by: Khem Raj --- .../yajl/yajl/0001-allow-build-with-cmake-4.patch | 93 ++++++++++++++++++++++ meta-oe/recipes-devtools/yajl/yajl_2.1.0.bb | 2 +- 2 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-devtools/yajl/yajl/0001-allow-build-with-cmake-4.patch diff --git a/meta-oe/recipes-devtools/yajl/yajl/0001-allow-build-with-cmake-4.patch b/meta-oe/recipes-devtools/yajl/yajl/0001-allow-build-with-cmake-4.patch new file mode 100644 index 0000000000..78076e5c1e --- /dev/null +++ b/meta-oe/recipes-devtools/yajl/yajl/0001-allow-build-with-cmake-4.patch @@ -0,0 +1,93 @@ +From e67398dad70e5d0174ad0eca5c293a5bf1ce1796 Mon Sep 17 00:00:00 2001 +From: Alper Ak +Date: Thu, 10 Jul 2025 00:00:33 +0300 +Subject: [PATCH] cmake: Set minimum required version to 3.5 for CMake 4+ + compatibility + +CMake 3.0 and newer disallow reading the LOCATION property of targets directly. +Instead, use the recommended $ generator expression when +referencing the output binary in add_custom_command. + +Fix: + +| CMake Error at CMakeLists.txt:15 (CMAKE_MINIMUM_REQUIRED): +| Compatibility with CMake < 3.5 has been removed from CMake. +| +| Update the VERSION argument value. Or, use the ... syntax +| to tell CMake that the project requires at least but has been updated +| to work with policies introduced by or earlier. +| +| Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway. +| +| +| -- Configuring incomplete, errors occurred! + +--- + +| CMake Error at reformatter/CMakeLists.txt:38 (GET_TARGET_PROPERTY): +| The LOCATION property may not be read from target "json_reformat". Use the +| target name directly with add_custom_command, or use the generator +| expression $, as appropriate. +| +| +| +| CMake Error at verify/CMakeLists.txt:32 (GET_TARGET_PROPERTY): +| The LOCATION property may not be read from target "json_verify". Use the +| target name directly with add_custom_command, or use the generator +| expression $, as appropriate. + +Upstream-Status: Submitted [https://github.com/lloyd/yajl/pull/256] + +Signed-off-by: Alper Ak +--- + CMakeLists.txt | 2 +- + reformatter/CMakeLists.txt | 4 +--- + verify/CMakeLists.txt | 4 +--- + 3 files changed, 3 insertions(+), 7 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4c0a9be..e7031c8 100644 +--- 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) + +diff --git a/reformatter/CMakeLists.txt b/reformatter/CMakeLists.txt +index 52a9bee..267d02e 100644 +--- 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 $ ${binDir}) + + INSTALL(TARGETS json_reformat RUNTIME DESTINATION bin) +diff --git a/verify/CMakeLists.txt b/verify/CMakeLists.txt +index 967fca1..2f39008 100644 +--- 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 $ ${binDir}) + + INSTALL(TARGETS json_verify RUNTIME DESTINATION bin) +-- +2.43.0 + diff --git a/meta-oe/recipes-devtools/yajl/yajl_2.1.0.bb b/meta-oe/recipes-devtools/yajl/yajl_2.1.0.bb index e4434bee45..6951e7e705 100644 --- a/meta-oe/recipes-devtools/yajl/yajl_2.1.0.bb +++ b/meta-oe/recipes-devtools/yajl/yajl_2.1.0.bb @@ -12,10 +12,10 @@ SRC_URI = "git://github.com/lloyd/yajl;branch=master;protocol=https \ file://CVE-2017-16516.patch \ file://CVE-2022-24795.patch \ file://CVE-2023-33460.patch \ + file://0001-allow-build-with-cmake-4.patch \ " SRCREV = "a0ecdde0c042b9256170f2f8890dd9451a4240aa" - inherit cmake lib_package EXTRA_OECMAKE = "-DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')}" -- cgit v1.2.3-54-g00ecf