mirror of
https://github.com/gbdev/rgbds.git
synced 2026-06-14 20:52:11 +00:00
Link zlib and libpng statically by default
Only when we are building them ourselves, that is.
This commit is contained in:
@@ -118,6 +118,10 @@ FetchContent_MakeAvailable(ZLIB)
|
|||||||
if(NOT DEFINED ZLIB_INCLUDE_DIRS)
|
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.
|
set(ZLIB_INCLUDE_DIRS "${zlib_BINARY_DIR};${zlib_SOURCE_DIR}") # libpng's `genout` script relies on this variable to be set.
|
||||||
endif()
|
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.
|
if(NOT DEFINED PNG_TESTS) # Unless overridden (e.g. in the cache), we don't care about libpng's tests.
|
||||||
set(PNG_TESTS OFF)
|
set(PNG_TESTS OFF)
|
||||||
|
|||||||
+6
-6
@@ -8,10 +8,10 @@ FetchContent_Declare(PNG
|
|||||||
EXCLUDE_FROM_ALL # We only install the runtime dependencies, and do so separately.
|
EXCLUDE_FROM_ALL # We only install the runtime dependencies, and do so separately.
|
||||||
FIND_PACKAGE_ARGS 1.5.4)
|
FIND_PACKAGE_ARGS 1.5.4)
|
||||||
|
|
||||||
set(PNG_TESTS OFF CACHE INTERNAL "") # We do not care for these two (and they can even cause compile errors!)
|
set(PNG_TESTS OFF CACHE INTERNAL "") # We do not need libpng's tests or tools
|
||||||
set(PNG_TOOLS OFF CACHE INTERNAL "")
|
set(PNG_TOOLS OFF CACHE INTERNAL "") # (and they can even cause compile errors!)
|
||||||
set(PNG_SHARED ON CACHE INTERNAL "") # Upstream seems to favour the dynamic lib over the static one?
|
set(PNG_SHARED OFF CACHE INTERNAL "")
|
||||||
set(PNG_STATIC OFF CACHE INTERNAL "")
|
set(PNG_STATIC ON CACHE INTERNAL "")
|
||||||
|
|
||||||
FetchContent_Declare(ZLIB
|
FetchContent_Declare(ZLIB
|
||||||
URL https://www.zlib.net/zlib-1.3.2.tar.xz
|
URL https://www.zlib.net/zlib-1.3.2.tar.xz
|
||||||
@@ -21,5 +21,5 @@ FetchContent_Declare(ZLIB
|
|||||||
# We thus enforce 1.0.4, but note that the libpng source code mentions that "it may work with versions as old as zlib 0.95".
|
# We thus enforce 1.0.4, but note that the libpng source code mentions that "it may work with versions as old as zlib 0.95".
|
||||||
FIND_PACKAGE_ARGS 1.0.4)
|
FIND_PACKAGE_ARGS 1.0.4)
|
||||||
|
|
||||||
set(ZLIB_BUILD_SHARED ON CACHE INTERNAL "")
|
set(ZLIB_BUILD_SHARED OFF CACHE INTERNAL "")
|
||||||
set(ZLIB_BUILD_STATIC OFF CACHE INTERNAL "")
|
set(ZLIB_BUILD_STATIC ON CACHE INTERNAL "")
|
||||||
|
|||||||
Reference in New Issue
Block a user