Skip to content

Commit

Permalink
Fix the zlib build error that was reported in AcademySoftwareFoundati…
Browse files Browse the repository at this point in the history
…on#1360. (AcademySoftwareFoundation#1361)

Signed-off-by: Dirk Lemstra <dirk@lemstra.org>
  • Loading branch information
dlemstra authored and cary-ilm committed Mar 26, 2023
1 parent 4e861cd commit 1b69fcb
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cmake/OpenEXRSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,16 @@ if(OPENEXR_FORCE_INTERNAL_ZLIB OR NOT TARGET ZLIB::ZLIB)
set(zlibpostfix "d")
endif()

add_library(zlib_static STATIC IMPORTED GLOBAL)
add_dependencies(zlib_static zlib_external)
set_property(TARGET zlib_static PROPERTY
IMPORTED_LOCATION "${zlib_INTERNAL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${zlibstaticlibname}${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
set_property(TARGET zlib_static PROPERTY
IMPORTED_LOCATION_DEBUG "${zlib_INTERNAL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${zlibstaticlibname}${zlibpostfix}${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
target_include_directories(zlib_static INTERFACE "${zlib_INTERNAL_DIR}/include")

if(NOT (APPLE OR WIN32) AND BUILD_SHARED_LIBS AND NOT OPENEXR_FORCE_INTERNAL_ZLIB)
add_library(zlib_shared SHARED IMPORTED GLOBAL)
add_dependencies(zlib_shared zlib_external)
Expand All @@ -236,16 +246,6 @@ if(OPENEXR_FORCE_INTERNAL_ZLIB OR NOT TARGET ZLIB::ZLIB)
target_include_directories(zlib_shared INTERFACE "${zlib_INTERNAL_DIR}/include")
endif()

add_library(zlib_static STATIC IMPORTED GLOBAL)
add_dependencies(zlib_static zlib_external)
set_property(TARGET zlib_static PROPERTY
IMPORTED_LOCATION "${zlib_INTERNAL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${zlibstaticlibname}${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
set_property(TARGET zlib_static PROPERTY
IMPORTED_LOCATION_DEBUG "${zlib_INTERNAL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${zlibstaticlibname}${zlibpostfix}${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
target_include_directories(zlib_static INTERFACE "${zlib_INTERNAL_DIR}/include")

if(NOT (APPLE OR WIN32) AND BUILD_SHARED_LIBS AND NOT OPENEXR_FORCE_INTERNAL_ZLIB)
add_library(ZLIB::ZLIB ALIAS zlib_shared)
else()
Expand Down

0 comments on commit 1b69fcb

Please sign in to comment.