From 36beb9bf4e1bfc20fca56c5753825e87759717f2 Mon Sep 17 00:00:00 2001 From: Zach Lewis Date: Sun, 12 Jul 2026 13:49:44 -0400 Subject: [PATCH 1/3] build(cmake): guard libtiff's missing Deflate target Static libtiff package exports can reference Deflate::Deflate without importing the target. Quietly load libdeflate's config and supply the alias before TIFF discovery when needed. Fixes #4439 Assisted-by: Codex / GPT-5 Signed-off-by: Zach Lewis --- src/cmake/externalpackages.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake index 107b8ad255..02f215b871 100644 --- a/src/cmake/externalpackages.cmake +++ b/src/cmake/externalpackages.cmake @@ -90,6 +90,14 @@ endif () checked_find_package (libuhdr VERSION_MIN 1.3) +# Static libtiff configs may reference this target without importing it. +# https://github.com/AcademySoftwareFoundation/OpenImageIO/issues/4439 +if (NOT TARGET Deflate::Deflate) + find_package (libdeflate CONFIG QUIET) + alias_library_if_not_exists (Deflate::Deflate libdeflate::libdeflate_static) + alias_library_if_not_exists (Deflate::Deflate libdeflate::libdeflate_shared) +endif () + checked_find_package (TIFF REQUIRED VERSION_MIN 4.0 RECOMMEND_MIN 4.5 From 9bdcdfeb46ef2a9f515724c7bd52e38799306927 Mon Sep 17 00:00:00 2001 From: Zach Lewis Date: Sun, 12 Jul 2026 15:41:00 -0400 Subject: [PATCH 2/3] build(cmake): link libtiff workaround upstream Reference the upstream libtiff report from the defensive target guard. Assisted-by: Codex / GPT-5 Signed-off-by: Zach Lewis --- src/cmake/externalpackages.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake index 02f215b871..46db62798c 100644 --- a/src/cmake/externalpackages.cmake +++ b/src/cmake/externalpackages.cmake @@ -91,7 +91,7 @@ checked_find_package (libuhdr VERSION_MIN 1.3) # Static libtiff configs may reference this target without importing it. -# https://github.com/AcademySoftwareFoundation/OpenImageIO/issues/4439 +# https://gitlab.com/libtiff/libtiff/-/work_items/871 if (NOT TARGET Deflate::Deflate) find_package (libdeflate CONFIG QUIET) alias_library_if_not_exists (Deflate::Deflate libdeflate::libdeflate_static) From 5b9af7c7de6be1fc49fe46f8365cf71158d7debe Mon Sep 17 00:00:00 2001 From: Zach Lewis Date: Sun, 12 Jul 2026 16:29:36 -0400 Subject: [PATCH 3/3] build(cmake): guard static OIIO consumers Define libtiff's missing Deflate target before the installed static OpenImageIO package resolves its TIFF dependency. Assisted-by: Codex / GPT-5 Signed-off-by: Zach Lewis --- src/cmake/Config.cmake.in | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/cmake/Config.cmake.in b/src/cmake/Config.cmake.in index 080a499968..94e1924a6d 100644 --- a/src/cmake/Config.cmake.in +++ b/src/cmake/Config.cmake.in @@ -20,6 +20,16 @@ if (NOT @BUILD_SHARED_LIBS@) # This is required in static library builds, as e.g. PNG::PNG appears among # INTERFACE_LINK_LIBRARIES. If the project does not know about PNG target, it will cause # configuration error about unknown targets being linked in. + # Static libtiff configs may reference this target without importing it. + # https://gitlab.com/libtiff/libtiff/-/work_items/871 + if (NOT TARGET Deflate::Deflate) + find_package (libdeflate CONFIG QUIET) + if (TARGET libdeflate::libdeflate_static) + add_library (Deflate::Deflate ALIAS libdeflate::libdeflate_static) + elseif (TARGET libdeflate::libdeflate_shared) + add_library (Deflate::Deflate ALIAS libdeflate::libdeflate_shared) + endif () + endif () find_dependency(TIFF) find_dependency(OpenColorIO) if (@JPEG_FOUND@)