Skip to content

Commit

Permalink
CMake: use EXCLUDE_FROM_ALL when declaring Fetch for deflate library
Browse files Browse the repository at this point in the history
Commit af9ef0e made a change in the CMake setup to switch from using
FetchContent_Populate() to FetchContent_MakeAvailable() to bring in
libdeflate (and Imath) as dependencies. Using FetchContent_MakeAvailable()
has the side effect that libdeflate is now being included as part of the
build, causing libraries and headers to be built and installed.

The intent with fetching the deflate source is solely to copy select
files into OpenEXRCore, so this change adds the EXCLUDE_FROM_ALL option
to the call to FetchContent_Declare() to prevent deflate from being
included in the build.
  • Loading branch information
mattyjams committed Oct 11, 2024
1 parent 3d34ea0 commit 9ff8533
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmake/OpenEXRSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,13 @@ else()
message(STATUS "libdeflate was not found, installing from ${OPENEXR_DEFLATE_REPO} (${OPENEXR_DEFLATE_TAG})")
endif()
include(FetchContent)
# Fetch deflate but exclude it from the "all" target.
# This prevents the library from being built.
FetchContent_Declare(Deflate
GIT_REPOSITORY "${OPENEXR_DEFLATE_REPO}"
GIT_TAG "${OPENEXR_DEFLATE_TAG}"
GIT_SHALLOW ON
EXCLUDE_FROM_ALL
)

FetchContent_GetProperties(Deflate)
Expand Down

0 comments on commit 9ff8533

Please sign in to comment.