minecraft-pi-reborn/dependencies/libpng/CMakeLists.txt

30 lines
899 B
CMake
Raw Normal View History

2021-06-17 21:32:24 +00:00
project(libpng)
include(FetchContent)
# Silence Warnings
add_compile_options(-w)
## LibPNG
# Download
FetchContent_Declare(
libpng
2021-09-14 23:29:48 +00:00
GIT_REPOSITORY "https://github.com/glennrp/libpng.git"
2021-06-17 21:32:24 +00:00
GIT_TAG "v1.2.59"
)
FetchContent_Populate(libpng)
set(ZLIB_LIBRARY zlib)
set(ZLIB_INCLUDE_DIR "${zlib_SOURCE_DIR}" "${zlib_BINARY_DIR}")
set(CMAKE_POLICY_DEFAULT_CMP0054 OLD) # Silence Warning
2021-10-12 20:13:11 +00:00
add_subdirectory("${libpng_SOURCE_DIR}" "${libpng_BINARY_DIR}" EXCLUDE_FROM_ALL)
2021-06-17 21:32:24 +00:00
set(CMAKE_POLICY_DEFAULT_CMP0054 NEW) # Re-Enable New Behavior
set_target_properties(png12 PROPERTIES LINK_FLAGS "-Wl,--version-script='${CMAKE_CURRENT_SOURCE_DIR}/libpng.vers'") # Use Symbol Versioning
set_target_properties(png12 PROPERTIES DEBUG_POSTFIX "") # Fix LibPNG Suffix In Debug Mode
2021-10-22 21:28:26 +00:00
# Ensure Build
2021-10-22 22:36:09 +00:00
add_custom_target(png12-build ALL DEPENDS png12)
2021-06-17 21:32:24 +00:00
# Install
install(TARGETS png12 DESTINATION "${MCPI_LIB_DIR}")