Deps: macOS: Prevent accidental linking to system-wide libraries for certain deps

On the macOS deps builder, if certain libraries were installed
system-wide using Homebrew, they could be prioritized during the
linking of dependencies over our own versions, causing breakages
when running the built libraries on other systems.

For OpenColorIO, homebrew Imath could be linked if installed.
For TIFF (& libjpeg as a transitive dep), homebrew libdeflate
could be linked if installed.

This commit fixes both of these issues by directly specifying the
library path to prevent the linker from wrongly inferring it to a
system-wide path.
This commit is contained in:
Jonas Holzman
2025-06-16 08:44:43 +02:00
parent 976efdcac9
commit 918db88a34
2 changed files with 11 additions and 1 deletions

View File

@@ -32,10 +32,12 @@ set(OPENCOLORIO_EXTRA_ARGS
)
if(APPLE)
# Work around issue where minizip-ng_LIBRARY assumes -ng in file name.
set(OPENCOLORIO_EXTRA_ARGS
${OPENCOLORIO_EXTRA_ARGS}
# Work around issue where minizip-ng_LIBRARY assumes -ng in file name.
-Dminizip_LIBRARY=${LIBDIR}/minizipng/lib/libminizip${LIBEXT}
# Work around issue where homebrew Imath's can be prioritized over our own dependency during linking if installed.
-DImath_LIBRARY=${LIBDIR}/imath/lib/libImath${SHAREDLIBEXT}
)
endif()

View File

@@ -18,6 +18,14 @@ set(TIFF_EXTRA_ARGS
-Dsphinx=OFF
)
if(APPLE)
set(TIFF_EXTRA_ARGS
${TIFF_EXTRA_ARGS}
# Work around issue where homebrew's libdeflate can be prioritized over our own dependency during linking if installed.
-DDeflate_LIBRARY=${LIBDIR}/deflate/lib/libdeflate${LIBEXT}
)
endif()
ExternalProject_Add(external_tiff
URL file://${PACKAGE_DIR}/${TIFF_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}