0
|
1 if (${STATIC_BUILD})
|
|
2 SET(LIBPNG_SOURCES_DIR ${CMAKE_BINARY_DIR}/libpng-1.5.12)
|
|
3 DownloadPackage("http://download.sourceforge.net/libpng/libpng-1.5.12.tar.gz" "${LIBPNG_SOURCES_DIR}" "${LIBPNG_PRELOADED}" "")
|
|
4
|
|
5 include_directories(
|
|
6 ${LIBPNG_SOURCES_DIR}
|
|
7 )
|
|
8
|
|
9 configure_file(
|
|
10 ${LIBPNG_SOURCES_DIR}/scripts/pnglibconf.h.prebuilt
|
|
11 ${LIBPNG_SOURCES_DIR}/pnglibconf.h
|
|
12 COPY_ONLY)
|
|
13
|
|
14 set(LIBPNG_SOURCES
|
|
15 #${LIBPNG_SOURCES_DIR}/example.c
|
|
16 ${LIBPNG_SOURCES_DIR}/png.c
|
|
17 ${LIBPNG_SOURCES_DIR}/pngerror.c
|
|
18 ${LIBPNG_SOURCES_DIR}/pngget.c
|
|
19 ${LIBPNG_SOURCES_DIR}/pngmem.c
|
|
20 ${LIBPNG_SOURCES_DIR}/pngpread.c
|
|
21 ${LIBPNG_SOURCES_DIR}/pngread.c
|
|
22 ${LIBPNG_SOURCES_DIR}/pngrio.c
|
|
23 ${LIBPNG_SOURCES_DIR}/pngrtran.c
|
|
24 ${LIBPNG_SOURCES_DIR}/pngrutil.c
|
|
25 ${LIBPNG_SOURCES_DIR}/pngset.c
|
|
26 #${LIBPNG_SOURCES_DIR}/pngtest.c
|
|
27 ${LIBPNG_SOURCES_DIR}/pngtrans.c
|
|
28 ${LIBPNG_SOURCES_DIR}/pngwio.c
|
|
29 ${LIBPNG_SOURCES_DIR}/pngwrite.c
|
|
30 ${LIBPNG_SOURCES_DIR}/pngwtran.c
|
|
31 ${LIBPNG_SOURCES_DIR}/pngwutil.c
|
|
32 )
|
|
33
|
|
34 #set_property(
|
|
35 # SOURCE ${LIBPNG_SOURCES}
|
|
36 # PROPERTY COMPILE_FLAGS -UHAVE_CONFIG_H)
|
|
37
|
|
38 list(APPEND THIRD_PARTY_SOURCES ${LIBPNG_SOURCES})
|
|
39
|
|
40 add_definitions(
|
|
41 -DPNG_NO_CONSOLE_IO=1
|
|
42 -DPNG_NO_STDIO=1
|
|
43 )
|
|
44
|
|
45 else()
|
|
46 include(FindPNG)
|
|
47
|
|
48 if (NOT ${PNG_FOUND})
|
|
49 message(FATAL_ERROR "Unable to find LibPNG")
|
|
50 endif()
|
|
51
|
|
52 include_directories(${PNG_INCLUDE_DIRS})
|
|
53 link_libraries(${PNG_LIBRARIES})
|
|
54 add_definitions(${PNG_DEFINITIONS})
|
|
55 endif()
|