Link zlib and libpng statically by default

Only when we are building them ourselves, that is.
This commit is contained in:
ISSOtm
2026-05-14 01:06:16 +02:00
committed by Eldred Habert
parent 42e3da837c
commit fee177d0b9
2 changed files with 10 additions and 6 deletions
+4
View File
@@ -118,6 +118,10 @@ FetchContent_MakeAvailable(ZLIB)
if(NOT DEFINED ZLIB_INCLUDE_DIRS)
set(ZLIB_INCLUDE_DIRS "${zlib_BINARY_DIR};${zlib_SOURCE_DIR}") # libpng's `genout` script relies on this variable to be set.
endif()
# Statically building zlib (from source) generates a target named differently.
if(NOT TARGET ZLIB::ZLIB AND TARGET zlibstatic)
add_library(ZLIB::ZLIB ALIAS zlibstatic)
endif()
if(NOT DEFINED PNG_TESTS) # Unless overridden (e.g. in the cache), we don't care about libpng's tests.
set(PNG_TESTS OFF)