PROJECT(libpng C)

INCLUDE_DIRECTORIES(
  "${CMAKE_CURRENT_SOURCE_DIR}"
  ${OPENJPEG_SOURCE_DIR}/thirdparty/include
)

FILE(GLOB SRCS *.c)
FILE(GLOB HDRS *.h)
SET(EXT_HDRS 
 ${OPENJPEG_SOURCE_DIR}/thirdparty/include/zlib.h
 ${OPENJPEG_SOURCE_DIR}/thirdparty/include/zconf.h
)
#
SET(LIBTARGET "png")
#
ADD_LIBRARY(${LIBTARGET} STATIC ${SRCS} ${HDRS} ${EXT_HDRS})
#
IF(MSVC)
  SET_TARGET_PROPERTIES(${LIBTARGET} PROPERTIES PREFIX "lib")
ENDIF(MSVC)
#
TARGET_LINK_LIBRARIES(${LIBTARGET} ${Z_LIBNAME} ${M_LIBRARY})
#
SET_TARGET_PROPERTIES(${LIBTARGET}
	PROPERTIES 
    OUTPUT_NAME "${LIBTARGET}"
	ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/lib)
#
