Make OpenJPEGConfig.cmake relocatable with CMake > 3.0 1439/head
authorAlex Richardson <arichardson@FreeBSD.org>
Thu, 11 Aug 2022 12:09:04 +0000 (12:09 +0000)
committerAlex Richardson <arichardson@FreeBSD.org>
Thu, 11 Aug 2022 12:13:18 +0000 (12:13 +0000)
commitc6ceb84c221b5094f1e8a4c0c247dee3fb5074e8
tree671261fd48df2b6e8058f104b968909f4f337f7b
parentc7bccf0515892617af984328e96cff5b4a6cd6d3
Make OpenJPEGConfig.cmake relocatable with CMake > 3.0

Using CMakePackageConfigHelpers, we can generate a relocatable
OpenJPEGConfig.config, using the PATH_VARS feature to make
CMAKE_INSTALL_LIBDIR relative to the installed location.
This change is needed for me when cross-compiling since
CMAKE_INSTALL_FULL_LIBDIR is a path inside the sysroot rather than
an absolute path to the actual includes. Without this change poppler
ends up passing a -I flag that does not exist.

This includes fallback code for CMake 2.8, which adds a bit of complexity,
since I'm not sure if raising the minimum to 3.0 (now over 8 years old)
is acceptable.
CMakeLists.txt
cmake/OpenJPEGConfig.cmake.in