The generated .cmake files were using but not defining dependencies if
they were taken from the system instead of bundled, backport a patch
from upstream to fix this.

Signed-off-by: Ross Burton <[email protected]>
---
 .../jpeg/libjpeg-turbo/zlib.patch             | 50 +++++++++++++++++++
 .../jpeg/libjpeg-turbo_3.2.0.bb               |  3 +-
 2 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-graphics/jpeg/libjpeg-turbo/zlib.patch

diff --git a/meta/recipes-graphics/jpeg/libjpeg-turbo/zlib.patch 
b/meta/recipes-graphics/jpeg/libjpeg-turbo/zlib.patch
new file mode 100644
index 00000000000..4a62eecb8ab
--- /dev/null
+++ b/meta/recipes-graphics/jpeg/libjpeg-turbo/zlib.patch
@@ -0,0 +1,50 @@
+From 95156233739078e7d4de0aeeacc4b0595630f393 Mon Sep 17 00:00:00 2001
+From: DRC <[email protected]>
+Date: Wed, 15 Jul 2026 13:03:38 -0400
+Subject: [PATCH] Build: Fix CMake pkg config file if WITH_SYSTEM_*
+
+If WITH_SYSTEM_ZLIB or WITH_SYSTEM_SPNG is defined, then the generated
+CMake package config file will include (respectively)
+
+    INTERFACE_LINK_LIBRARIES "ZLIB::ZLIB"
+
+or
+
+    INTERFACE_LINK_LIBRARIES "PkgConfig::spng"
+
+in the libjpeg-turbo::turbojpeg and libjpeg-turbo::turbojpeg-static
+target properties.  Thus, our CMake package config file needs to find
+those dependencies.
+
+Fixes #901
+
+Upstream-Status: Backport 
[https://github.com/libjpeg-turbo/libjpeg-turbo/commit/95156233739078e7d4de0aeeacc4b0595630f393]
+Signed-off-by: Ross Burton <[email protected]>
+---
+ release/Config.cmake.in | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/release/Config.cmake.in b/release/Config.cmake.in
+index 0c1ba8aa6d..04c147ef0a 100644
+--- a/release/Config.cmake.in
++++ b/release/Config.cmake.in
+@@ -1,4 +1,19 @@
+ @PACKAGE_INIT@
+ 
++set(WITH_SYSTEM_SPNG @WITH_SYSTEM_SPNG@)
++set(WITH_SYSTEM_ZLIB @WITH_SYSTEM_ZLIB@)
++
++if(WITH_SYSTEM_SPNG OR WITH_SYSTEM_ZLIB)
++  include(CMakeFindDependencyMacro)
++  if(WITH_SYSTEM_SPNG)
++    find_dependency(PkgConfig)
++    if(PkgConfig_FOUND)
++      pkg_check_modules(spng REQUIRED spng IMPORTED_TARGET)
++    endif()
++  else()
++    find_dependency(ZLIB)
++  endif()
++endif()
++
+ include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
+ check_required_components("@CMAKE_PROJECT_NAME@")
diff --git a/meta/recipes-graphics/jpeg/libjpeg-turbo_3.2.0.bb 
b/meta/recipes-graphics/jpeg/libjpeg-turbo_3.2.0.bb
index 7a548d4e9c6..3364c0fb565 100644
--- a/meta/recipes-graphics/jpeg/libjpeg-turbo_3.2.0.bb
+++ b/meta/recipes-graphics/jpeg/libjpeg-turbo_3.2.0.bb
@@ -9,7 +9,8 @@ DEPENDS = "zlib"
 DEPENDS:append:x86-64:class-target = " nasm-native"
 DEPENDS:append:x86:class-target = " nasm-native"
 
-SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.gz"
+SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.gz \
+           file://zlib.patch"
 SRC_URI[sha256sum] = 
"6f30092cef9fb839779646608f4ee14ae3cbac989c47fa05e841b0841f09878e"
 UPSTREAM_CHECK_REGEX = "releases/tag/(?P<pver>\d+\.\d+\.(?!9\d+)\d+(\.\d+)*)"
 
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#245858): 
https://lists.openembedded.org/g/openembedded-core/message/245858
Mute This Topic: https://lists.openembedded.org/mt/121263082/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to