Unbundle Patch - Add opt-in system-lib linking for vendoured sub-dependencies - #51
Merged
Conversation
danoli3
force-pushed
the
feat/unbundle-system-libs
branch
from
August 16, 2026 08:47
fc1e712 to
e90e548
Compare
The old FreeImage.cmake convention (predating USE_SYSTEM_LIBPNG/ USE_SYSTEM_ZLIB) used BUILD_LIBPNG=OFF/BUILD_ZLIB=OFF together with PNG_LIBRARY/ZLIB_LIBRARY to mean "link a system copy", not "no PNG/ zlib support at all". openFrameworks' apothecary FreeImage formula still builds this way, and so did this repo's own new openFrameworks CI job - both broke against this PR's new BUILD_X semantics. Treat DEFINED PNG_LIBRARY/ZLIB_LIBRARY as implicitly enabling the system-link branch even without BUILD_X or USE_SYSTEM_X set, and map the old include-dir variable names (PNG_INCLUDE_DIR, ZLIB_INCLUDE_DIRS) onto the ones find_package(PNG)/find_package(ZLIB) actually read as hints (PNG_PNG_INCLUDE_DIR, ZLIB_INCLUDE_DIR) - confirmed via FindPNG.cmake/FindZLIB.cmake source, they don't match the old names. Verified: default build, USE_SYSTEM_LIBS=ON build, and the exact old -DBUILD_LIBPNG=OFF -DPNG_LIBRARY=... convention all still build clean.
danoli3
force-pushed
the
feat/unbundle-system-libs
branch
from
August 16, 2026 10:25
97c3ca3 to
128b715
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds CMake support for linking FreeImage against system-installed copies of its vendored sub-dependencies instead of always compiling the bundled forks under
Source/Lib*, following MSYS2's mingw-w64-freeimage package:https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-freeimage
BUILD_XUSE_SYSTEM_XBUILD_ZLIBUSE_SYSTEM_ZLIBBUILD_LIBPNGUSE_SYSTEM_LIBPNGBUILD_LIBTIFFUSE_SYSTEM_LIBTIFFBUILD_LIBJPEGUSE_SYSTEM_LIBJPEGBUILD_LIBOPENJPEGUSE_SYSTEM_LIBOPENJPEGBUILD_WEBPUSE_SYSTEM_WEBPBUILD_LIBRAWLITEUSE_SYSTEM_LIBRAWLITEBUILD_OPENEXRUSE_SYSTEM_OPENEXRBUILD_JXRUSE_SYSTEM_JXRAll
USE_SYSTEM_*default OFF (bundled, unchanged default build);FREEIMAGE_USE_SYSTEM_LIBS=ONflips them all on at once.BUILD_X=OFFalone (no system replacement) only cleanly drops the feature for webp/libraw/OpenEXR/jxrlib - the other five needUSE_SYSTEM_X=ONtoo, or the build breaks. Same gap as pre-PR51 (BUILD_LIBPNG=OFFwithoutPNG_LIBRARYalready broke;BUILD_LIBJPEG/BUILD_LIBOPENJPEGdidn't exist as options).FreeImage.h's public API stays unchanged - G3 fax loading andFreeImage_JPEGTransform*need libtiff/libjpeg private headers system packages don't ship, so they fall back to a clean "unsupported" result underUSE_SYSTEM_LIBTIFF/USE_SYSTEM_LIBJPEGinstead of being removed.Re #35: 7 of those 25 CVEs (OpenEXR + OpenJPEG) live in bundled library code and are likely dodged by
USE_SYSTEM_OPENEXR/USE_SYSTEM_LIBOPENJPEG: #35 (comment)Fixes: #44
Fixes: #11