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 $<TARGET_FILE:target> 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 <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!

-----

| 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 $<TARGET_FILE>, 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 $<TARGET_FILE>, as appropriate.

Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Alper Ak 2025-07-10 00:11:12 +03:00 committed by Khem Raj
parent ef64c35092
commit 40dd3e9cc1
No known key found for this signature in database
GPG Key ID: BB053355919D3314
2 changed files with 94 additions and 1 deletions

View File

@ -0,0 +1,93 @@
From e67398dad70e5d0174ad0eca5c293a5bf1ce1796 Mon Sep 17 00:00:00 2001
From: Alper Ak <alperyasinak1@gmail.com>
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 $<TARGET_FILE:target> 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 <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!
---
| 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 $<TARGET_FILE>, 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 $<TARGET_FILE>, as appropriate.
Upstream-Status: Submitted [https://github.com/lloyd/yajl/pull/256]
Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
---
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 $<TARGET_FILE:json_reformat> ${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 $<TARGET_FILE:json_verify> ${binDir})
INSTALL(TARGETS json_verify RUNTIME DESTINATION bin)
--
2.43.0

View File

@ -12,10 +12,10 @@ SRC_URI = "git://github.com/lloyd/yajl;branch=master;protocol=https \
file://CVE-2017-16516.patch \ file://CVE-2017-16516.patch \
file://CVE-2022-24795.patch \ file://CVE-2022-24795.patch \
file://CVE-2023-33460.patch \ file://CVE-2023-33460.patch \
file://0001-allow-build-with-cmake-4.patch \
" "
SRCREV = "a0ecdde0c042b9256170f2f8890dd9451a4240aa" SRCREV = "a0ecdde0c042b9256170f2f8890dd9451a4240aa"
inherit cmake lib_package inherit cmake lib_package
EXTRA_OECMAKE = "-DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')}" EXTRA_OECMAKE = "-DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')}"