Skip to content

Commit

Permalink
cmake: adapt to the new vendored libpng cmake'ry :
Browse files Browse the repository at this point in the history
- do not set PNG_BUILD_ZLIB: it's rejected by libpng with error.
  set ZLIB_ROOT, instead.
- set SKIP_INSTALL_CONFIG_FILE for the SDLIMAGE_ZLIB_SHARED case
  because libpng cmake config fails for zlibstatic.

(cherry picked from commit fb55536)
  • Loading branch information
sezero committed Jan 13, 2025
1 parent c1a41a3 commit 0d4d0ec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -367,15 +367,15 @@ if(SDL2IMAGE_ZLIB)
set(ZLIB_BUILD_EXAMPLES OFF CACHE BOOL "zlib examples" FORCE)
sdl_check_project_in_subfolder(external/zlib zlib SDL2IMAGE_VENDORED)
add_subdirectory(external/zlib EXCLUDE_FROM_ALL)
# PNG_BUILD_ZLIB variable is used by vendored libpng
set(PNG_BUILD_ZLIB ON CACHE BOOL "libpng option to tell it should use 'our' vendored ZLIB library" FORCE)
set(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/external/zlib;${CMAKE_CURRENT_BINARY_DIR}/external/zlib")
# ZLIB_INCLUDE_DIR variable is used by vendored libpng
set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/zlib;${CMAKE_CURRENT_BINARY_DIR}/external/zlib" CACHE STRING "path of zlib, passed to libpng" FORCE)
# ZLIB_LIBRARY variable is used by vendored libpng
if(SDL2IMAGE_ZLIB_SHARED)
set(ZLIB_LIBRARY zlib)
else()
set(ZLIB_LIBRARY zlibstatic)
set(SKIP_INSTALL_CONFIG_FILE ON)
endif()
if(NOT TARGET ZLIB::ZLIB)
add_library(ZLIB::ZLIB ALIAS ${ZLIB_LIBRARY})
Expand Down

0 comments on commit 0d4d0ec

Please sign in to comment.