From 0d4d0ecf7621de0e4b83bc82e44ffb1c7d849d4e Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Mon, 13 Jan 2025 18:11:40 +0300 Subject: [PATCH] cmake: adapt to the new vendored libpng cmake'ry : - 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 fb555360f995451c203c209c32fea8cbbb9dd1ef) --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eb996aaf..93d6ab19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -367,8 +367,7 @@ 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 @@ -376,6 +375,7 @@ if(SDL2IMAGE_ZLIB) 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})