Update zlib CMakeLists

This commit is contained in:
Luke Street 2021-06-14 17:18:15 -04:00
parent 2aa5b76732
commit daf8bf0595
1 changed files with 41 additions and 47 deletions

View File

@ -1,48 +1,42 @@
if (APPLE) if (APPLE)
# use toolchain zlib # always use toolchain zlib
find_package(ZLIB REQUIRED) set(ZLIB_REQUIRED REQUIRED)
add_library(z ALIAS ZLIB::ZLIB) # alias hack to allow use from global context endif ()
set(ZLIB_LIBRARIES z CACHE STRING "zlib libraries" FORCE) find_package(ZLIB ${ZLIB_REQUIRED})
else() if (ZLIB_FOUND)
if(NOT WIN32 AND NOT NX) # remove WIN32 when specter/freetype is gone add_library(z ALIAS ZLIB::ZLIB) # alias hack to allow use from global context
find_library(ZLIB_LIB NAMES zlib z) set(ZLIB_LIBRARIES z CACHE STRING "zlib libraries" FORCE)
endif() else ()
if(NOT ZLIB_LIB) message(STATUS "Using Athena's built-in zlib")
message(STATUS "Using Athena's built-in zlib") add_library(z
add_library(z adler32.c
adler32.c compress.c
compress.c crc32.c
crc32.c deflate.c
deflate.c infback.c
infback.c inffast.c
inffast.c inflate.c
inflate.c inftrees.c
inftrees.c trees.c
trees.c uncompr.c
uncompr.c zutil.c
zutil.c crc32.h
crc32.h deflate.h
deflate.h gzguts.h
gzguts.h inffast.h
inffast.h inffixed.h
inffixed.h inflate.h
inflate.h inftrees.h
inftrees.h trees.h
trees.h zconf.h
zconf.h zlib.h
zlib.h zutil.h)
zutil.h) if (WIN32 AND NOT UNIX)
if(WIN32 AND NOT UNIX) install(FILES zconf.h zlib.h DESTINATION include COMPONENT zlib)
install(FILES zconf.h zlib.h DESTINATION include COMPONENT zlib) install(TARGETS z DESTINATION lib COMPONENT zlib)
install(TARGETS z DESTINATION lib COMPONENT zlib) else ()
else() target_compile_options(z PRIVATE -Wno-implicit-fallthrough)
target_compile_options(z PRIVATE -Wno-implicit-fallthrough) endif ()
endif() set(ZLIB_LIBRARIES z CACHE STRING "zlib libraries" FORCE)
set(ZLIB_LIBRARIES z CACHE STRING "zlib libraries" FORCE) set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "zlib include directory" FORCE)
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "zlib include directory" FORCE) endif ()
else()
set(ZLIB_LIBRARIES ${ZLIB_LIB} CACHE PATH "zlib libraries" FORCE)
find_path(ZLIB_INCLUDE_DIR zlib.h PATHS "${PNG_LIB}/../../include")
message(STATUS "Using zlib at ${ZLIB_LIB}, include: ${ZLIB_INCLUDE_DIR}")
endif()
endif()