cmake_minimum_required(VERSION 2.6...3.29)
project(libpng)

set(LIBPNG_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
)

file(GLOB_RECURSE LIBPNG_HEADERS *.h)

include_directories(${zlib_SOURCE_DIR})
add_library(libpng STATIC ${LIBPNG_SOURCES} ${LIBPNG_HEADERS}) # remove static, cmake should take care of that
target_include_directories(libpng PUBLIC ${LIBPNG_HEADERS})
target_link_libraries(libpng zlib)

set_target_properties(libpng PROPERTIES FOLDER deps)