new file mode 100644
@@ -0,0 +1,50 @@
+From 95156233739078e7d4de0aeeacc4b0595630f393 Mon Sep 17 00:00:00 2001
+From: DRC <information@libjpeg-turbo.org>
+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 <ross.burton@arm.com>
+---
+ 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}/@CMAKE_PROJECT_NAME@Targets.cmake")
+ check_required_components("@CMAKE_PROJECT_NAME@")
@@ -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+)*)"
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 <ross.burton@arm.com> --- .../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