Skip to content

Commit 2e05c78

Browse files
jreichel-nvidialgritz
authored andcommitted
build: search for libbz2 only if FFmpeg or FreeType is enabled. (#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>
1 parent d1a7d12 commit 2e05c78

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/cmake/externalpackages.cmake

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,6 @@ endif ()
121121

122122
checked_find_package (PNG VERSION_MIN 1.6.0)
123123

124-
checked_find_package (BZip2) # Used by ffmpeg and freetype
125-
if (NOT BZIP2_FOUND)
126-
set (BZIP2_LIBRARIES "") # TODO: why does it break without this?
127-
endif ()
128-
129124
checked_find_package (Freetype
130125
VERSION_MIN 2.10.0
131126
DEFINITIONS USE_FREETYPE=1 )
@@ -191,6 +186,13 @@ checked_find_package (R3DSDK NO_RECORD_NOTFOUND) # RED camera
191186
set (NUKE_VERSION "7.0" CACHE STRING "Nuke version to target")
192187
checked_find_package (Nuke NO_RECORD_NOTFOUND)
193188

189+
if (FFmpeg_FOUND OR FREETYPE_FOUND)
190+
checked_find_package (BZip2) # Used by ffmpeg and freetype
191+
if (NOT BZIP2_FOUND)
192+
set (BZIP2_LIBRARIES "") # TODO: why does it break without this?
193+
endif ()
194+
endif()
195+
194196

195197
# Qt -- used for iv
196198
option (USE_QT "Use Qt if found" ON)

0 commit comments

Comments
 (0)