41 lines
897 B
CMake
41 lines
897 B
CMake
#cPNG source files
|
|
cmake_minimum_required(VERSION 3.16)
|
|
project(cPNG VERSION 1.5.30 LANGUAGES C)
|
|
find_package(cZlib 1.2.5 REQUIRED)
|
|
|
|
set(SOURCES
|
|
png.c
|
|
pngerror.c
|
|
pngget.c
|
|
pngmem.c
|
|
pngpread.c
|
|
pngread.c
|
|
pngrio.c
|
|
pngrtran.c
|
|
pngrutil.c
|
|
pngset.c
|
|
pngtrans.c
|
|
pngwio.c
|
|
pngwrite.c
|
|
pngwtran.c
|
|
pngwutil.c
|
|
)
|
|
|
|
# Target name is "cPNG", output file is "libcPNG.a" (by default)
|
|
add_library(cPNG STATIC ${SOURCES})
|
|
target_compile_options(cPNG PRIVATE -Os -std=c11)
|
|
target_link_libraries(cPNG PRIVATE cZlib::cZlib)
|
|
|
|
# After building, install the target (that is, cPNG.a) in the compiler
|
|
install(TARGETS cPNG
|
|
DESTINATION "${FXSDK_LIB}")
|
|
|
|
# Install png.h from the build dir
|
|
install(FILES png.h pngconf.h pnglibconf.h
|
|
DESTINATION "${FXSDK_INCLUDE}")
|
|
|
|
# Install FindcPNG.cmake so that users can do find_package(LibcPNG)
|
|
install(FILES cmake/FindcPNG.cmake
|
|
DESTINATION "${FXSDK_CMAKE_MODULE_PATH}")
|
|
|