Commit 39a2ac4f for libheif
commit 39a2ac4f683cd82207e4faf035126236c90606c2
Author: Dirk Farin <dirk.farin@gmail.com>
Date: Thu May 21 21:12:37 2026 +0200
OpenJPH: add parent include directory to support both include path variants
diff --git a/cmake/modules/FindOPENJPH.cmake b/cmake/modules/FindOPENJPH.cmake
index 7edb1221..55d8926c 100644
--- a/cmake/modules/FindOPENJPH.cmake
+++ b/cmake/modules/FindOPENJPH.cmake
@@ -5,6 +5,23 @@ if(TARGET openjph)
message(STATUS "Found openjph: ${OPENJPH_DIR}")
endif()
set(OPENJPH_LIBRARIES "openjph")
+
+ # OpenJPH's exported config sets the include directory to
+ # <prefix>/include/openjph, but libheif's sources include the headers with
+ # the "openjph/" prefix (e.g. #include "openjph/ojph_mem.h"). Add the parent
+ # directory so those includes resolve with both header layouts.
+ get_target_property(_openjph_incdirs openjph INTERFACE_INCLUDE_DIRECTORIES)
+ if(_openjph_incdirs)
+ foreach(_dir IN LISTS _openjph_incdirs)
+ list(APPEND OPENJPH_INCLUDE_DIRS "${_dir}")
+ if(_dir MATCHES "/openjph$")
+ get_filename_component(_parent "${_dir}" DIRECTORY)
+ list(APPEND OPENJPH_INCLUDE_DIRS "${_parent}")
+ endif()
+ endforeach()
+ unset(_parent)
+ endif()
+ unset(_openjph_incdirs)
else()
include(LibFindMacros)
libfind_pkg_check_modules(OPENJPH_PKGCONF openjph)