Skip to content

Commit

Permalink
build: search for libbz2 only if FFmpeg or FreeType is enabled. (Acad…
Browse files Browse the repository at this point in the history
…emySoftwareFoundation#4505)

Detect libbz2 only if necessary, i.e., FFmpeg or FreeType is enabled.
This avoids an unnecessary dependency on libbz2 if these features are
disabled.

In particular, with vcpkg, OpenImageIO might pick up a dependency on
libbz2.so from the host system since bzip2 from vcpkg is not listed as a
dependency of OpenImageIO (if the FFmpeg and FreeImage features are
disabled, and bzip2 is not already installed for other reasons).

Signed-off-by: Joachim Reichel <43646584+jreichel-nvidia@users.noreply.github.com>
  • Loading branch information
jreichel-nvidia authored and lgritz committed Oct 26, 2024
1 parent d1a7d12 commit 2e05c78
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/cmake/externalpackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@ endif ()

checked_find_package (PNG VERSION_MIN 1.6.0)

checked_find_package (BZip2) # Used by ffmpeg and freetype
if (NOT BZIP2_FOUND)
set (BZIP2_LIBRARIES "") # TODO: why does it break without this?
endif ()

checked_find_package (Freetype
VERSION_MIN 2.10.0
DEFINITIONS USE_FREETYPE=1 )
Expand Down Expand Up @@ -191,6 +186,13 @@ checked_find_package (R3DSDK NO_RECORD_NOTFOUND) # RED camera
set (NUKE_VERSION "7.0" CACHE STRING "Nuke version to target")
checked_find_package (Nuke NO_RECORD_NOTFOUND)

if (FFmpeg_FOUND OR FREETYPE_FOUND)
checked_find_package (BZip2) # Used by ffmpeg and freetype
if (NOT BZIP2_FOUND)
set (BZIP2_LIBRARIES "") # TODO: why does it break without this?
endif ()
endif()


# Qt -- used for iv
option (USE_QT "Use Qt if found" ON)
Expand Down

0 comments on commit 2e05c78

Please sign in to comment.