Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 2.4.3) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 2 | set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) |
| 3 | |
Glenn Randers-Pehrson | ee35abb | 2009-10-30 15:42:54 -0500 | [diff] [blame] | 4 | if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 5 | set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING |
| 6 | "Choose the type of build, options are: |
| 7 | None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) |
| 8 | Debug |
| 9 | Release |
| 10 | RelWithDebInfo |
| 11 | MinSizeRel.") |
Glenn Randers-Pehrson | ee35abb | 2009-10-30 15:42:54 -0500 | [diff] [blame] | 12 | endif() |
| 13 | |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 14 | project(libpng C) |
Glenn Randers-Pehrson | ee35abb | 2009-10-30 15:42:54 -0500 | [diff] [blame] | 15 | enable_testing() |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 16 | |
Glenn Randers-Pehrson | f81b50b | 2009-12-29 16:50:15 -0600 | [diff] [blame] | 17 | # Copyright (C) 2007-2010 Glenn Randers-Pehrson |
Glenn Randers-Pehrson | 3e61d79 | 2009-06-24 09:31:28 -0500 | [diff] [blame] | 18 | |
Glenn Randers-Pehrson | bfbf865 | 2009-06-26 21:46:52 -0500 | [diff] [blame] | 19 | # This code is released under the libpng license. |
Glenn Randers-Pehrson | c332bbc | 2009-06-25 13:43:50 -0500 | [diff] [blame] | 20 | # For conditions of distribution and use, see the disclaimer |
Glenn Randers-Pehrson | 037023b | 2009-06-24 10:27:36 -0500 | [diff] [blame] | 21 | # and license in png.h |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 22 | |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 23 | set(PNGLIB_MAJOR 1) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 24 | set(PNGLIB_MINOR 5) |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 25 | set(PNGLIB_RELEASE 0) |
| 26 | set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) |
| 27 | set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 28 | |
| 29 | # needed packages |
| 30 | find_package(ZLIB REQUIRED) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 31 | include_directories(${ZLIB_INCLUDE_DIR}) |
| 32 | |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 33 | if(NOT WIN32) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 34 | find_library(M_LIBRARY |
| 35 | NAMES m |
| 36 | PATHS /usr/lib /usr/local/lib |
| 37 | ) |
| 38 | if(NOT M_LIBRARY) |
| 39 | message(STATUS |
| 40 | "math library 'libm' not found - floating point support disabled") |
| 41 | endif() |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 42 | else() |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 43 | # not needed on windows |
| 44 | set(M_LIBRARY "") |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 45 | endif() |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 46 | |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 47 | # COMMAND LINE OPTIONS |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 48 | if(DEFINED PNG_SHARED) |
| 49 | option(PNG_SHARED "Build shared lib" ${PNG_SHARED}) |
| 50 | else() |
| 51 | option(PNG_SHARED "Build shared lib" ON) |
| 52 | endif() |
| 53 | if(DEFINED PNG_STATIC) |
| 54 | option(PNG_STATIC "Build static lib" ${PNG_STATIC}) |
| 55 | else() |
| 56 | option(PNG_STATIC "Build static lib" ON) |
| 57 | endif() |
| 58 | |
Glenn Randers-Pehrson glennrp@comcast.net | 7ecf7bd | 2009-05-02 15:36:08 -0500 | [diff] [blame] | 59 | if(MINGW) |
| 60 | option(PNG_TESTS "Build pngtest" NO) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 61 | else() |
Glenn Randers-Pehrson glennrp@comcast.net | 7ecf7bd | 2009-05-02 15:36:08 -0500 | [diff] [blame] | 62 | option(PNG_TESTS "Build pngtest" YES) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 63 | endif() |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 64 | |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 65 | option(PNG_NO_CONSOLE_IO "FIXME" YES) |
| 66 | option(PNG_NO_STDIO "FIXME" YES) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 67 | option(PNG_DEBUG "Build with debug output" NO) |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 68 | option(PNGARG "FIXME" YES) |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 69 | #TODO: |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 70 | # PNG_CONSOLE_IO_SUPPORTED |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 71 | |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 72 | # maybe needs improving, but currently I don't know when we can enable what :) |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 73 | set(png_asm_tmp "OFF") |
| 74 | if(NOT WIN32) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 75 | find_program(uname_executable NAMES uname PATHS /bin /usr/bin /usr/local/bin) |
| 76 | if(uname_executable) |
| 77 | exec_program(${uname_executable} |
| 78 | ARGS --machine OUTPUT_VARIABLE uname_output) |
| 79 | if("uname_output" MATCHES "^.*i[1-9]86.*$") |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 80 | set(png_asm_tmp "ON") |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 81 | else("uname_output" MATCHES "^.*i[1-9]86.*$") |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 82 | set(png_asm_tmp "OFF") |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 83 | endif("uname_output" MATCHES "^.*i[1-9]86.*$") |
| 84 | endif(uname_executable) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 85 | else() |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 86 | # this env var is normally only set on win64 |
| 87 | set(TEXT "ProgramFiles(x86)") |
| 88 | if("$ENV{${TEXT}}" STREQUAL "") |
| 89 | set(png_asm_tmp "ON") |
| 90 | endif("$ENV{${TEXT}}" STREQUAL "") |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 91 | endif() |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 92 | |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 93 | # SET LIBNAME |
Glenn Randers-Pehrson | 8c03730 | 2010-08-23 17:07:32 -0500 | [diff] [blame^] | 94 | set(PNG_LIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 95 | |
| 96 | # to distinguish between debug and release lib |
| 97 | set(CMAKE_DEBUG_POSTFIX "d") |
| 98 | |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 99 | |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 100 | # OUR SOURCES |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 101 | set(libpng_sources |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 102 | png.h |
| 103 | pngconf.h |
Glenn Randers-Pehrson | 8c03730 | 2010-08-23 17:07:32 -0500 | [diff] [blame^] | 104 | pngpriv.h |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 105 | png.c |
| 106 | pngerror.c |
| 107 | pngget.c |
| 108 | pngmem.c |
| 109 | pngpread.c |
| 110 | pngread.c |
| 111 | pngrio.c |
| 112 | pngrtran.c |
| 113 | pngrutil.c |
| 114 | pngset.c |
| 115 | pngtrans.c |
| 116 | pngwio.c |
| 117 | pngwrite.c |
| 118 | pngwtran.c |
| 119 | pngwutil.c |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 120 | ) |
| 121 | set(pngtest_sources |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 122 | pngtest.c |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 123 | ) |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 124 | # SOME NEEDED DEFINITIONS |
Glenn Randers-Pehrson | 69b0bc0 | 2009-11-07 12:02:48 -0600 | [diff] [blame] | 125 | |
Glenn Randers-Pehrson | 8c03730 | 2010-08-23 17:07:32 -0500 | [diff] [blame^] | 126 | add_definitions(-DPNG_CONFIGURE_LIBPNG) |
| 127 | |
| 128 | if(_AIX) |
| 129 | add_definitions(-D_ALL_SOURCE) |
| 130 | endif(_AIX) |
| 131 | |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 132 | if(MSVC) |
Glenn Randers-Pehrson | 8c03730 | 2010-08-23 17:07:32 -0500 | [diff] [blame^] | 133 | add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE) |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 134 | endif(MSVC) |
| 135 | |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 136 | if(PNG_SHARED OR NOT MSVC) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 137 | #if building msvc static this has NOT to be defined |
| 138 | add_definitions(-DZLIB_DLL) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 139 | endif() |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 140 | |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 141 | |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 142 | if(PNG_CONSOLE_IO_SUPPORTED) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 143 | add_definitions(-DPNG_CONSOLE_IO_SUPPORTED) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 144 | endif() |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 145 | |
| 146 | if(PNG_NO_CONSOLE_IO) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 147 | add_definitions(-DPNG_NO_CONSOLE_IO) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 148 | endif() |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 149 | |
| 150 | if(PNG_NO_STDIO) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 151 | add_definitions(-DPNG_NO_STDIO) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 152 | endif() |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 153 | |
| 154 | if(PNG_DEBUG) |
Glenn Randers-Pehrson | 8c03730 | 2010-08-23 17:07:32 -0500 | [diff] [blame^] | 155 | add_definitions(-DPNG_DEBUG) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 156 | endif() |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 157 | |
Glenn Randers-Pehrson glennrp@comcast.net | 7ecf7bd | 2009-05-02 15:36:08 -0500 | [diff] [blame] | 158 | if(NOT M_LIBRARY AND NOT WIN32) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 159 | add_definitions(-DPNG_NO_FLOATING_POINT_SUPPORTED) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 160 | endif() |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 161 | |
| 162 | # NOW BUILD OUR TARGET |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 163 | include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR}) |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 164 | |
| 165 | if(PNG_SHARED) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 166 | add_library(${PNG_LIB_NAME} SHARED ${libpng_sources}) |
| 167 | if(MSVC) |
| 168 | # msvc does not append 'lib' - do it here to have consistent name |
| 169 | set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib") |
| 170 | endif() |
| 171 | target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY}) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 172 | endif() |
| 173 | |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 174 | if(PNG_STATIC) |
| 175 | # does not work without changing name |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 176 | set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static) |
| 177 | add_library(${PNG_LIB_NAME_STATIC} STATIC ${libpng_sources}) |
| 178 | if(MSVC) |
| 179 | # msvc does not append 'lib' - do it here to have consistent name |
| 180 | set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib") |
| 181 | endif() |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 182 | endif() |
| 183 | |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 184 | |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 185 | if(PNG_SHARED AND WIN32) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 186 | set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 187 | endif() |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 188 | |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 189 | if(PNG_TESTS AND PNG_SHARED) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 190 | # does not work with msvc due to png_lib_ver issue |
| 191 | add_executable(pngtest ${pngtest_sources}) |
| 192 | target_link_libraries(pngtest ${PNG_LIB_NAME}) |
| 193 | add_test(pngtest pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 194 | endif() |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 195 | |
| 196 | |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 197 | # CREATE PKGCONFIG FILES |
| 198 | # we use the same files like ./configure, so we have to set its vars |
Glenn Randers-Pehrson | 8c03730 | 2010-08-23 17:07:32 -0500 | [diff] [blame^] | 199 | if(NOT DEFINED CMAKE_INSTALL_LIBDIR) |
| 200 | set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib) |
| 201 | endif(NOT DEFINED CMAKE_INSTALL_LIBDIR) |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 202 | set(prefix ${CMAKE_INSTALL_PREFIX}) |
| 203 | set(exec_prefix ${CMAKE_INSTALL_PREFIX}) |
Glenn Randers-Pehrson | 8c03730 | 2010-08-23 17:07:32 -0500 | [diff] [blame^] | 204 | set(libdir ${CMAKE_INSTALL_LIBDIR}) |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 205 | set(includedir ${CMAKE_INSTALL_PREFIX}/include) |
Glenn Randers-Pehrson | 8c03730 | 2010-08-23 17:07:32 -0500 | [diff] [blame^] | 206 | set(LIBS "-lz -lm") |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 207 | |
Glenn Randers-Pehrson | 8c03730 | 2010-08-23 17:07:32 -0500 | [diff] [blame^] | 208 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in |
| 209 | ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY) |
| 210 | install(CODE " |
| 211 | MESSAGE(STATUS \"Symlinking ${PNGLIB_NAME}.pc to libpng.pc\") |
| 212 | execute_process(COMMAND \${CMAKE_COMMAND} -E create_symlink |
| 213 | \"${PNGLIB_NAME}.pc\" |
| 214 | \"libpng.pc\") |
| 215 | ") |
| 216 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in |
| 217 | ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY) |
| 218 | install(CODE " |
| 219 | MESSAGE(STATUS \"Symlinking ${PNGLIB_NAME}-config to libpng-config\") |
| 220 | execute_process(COMMAND \${CMAKE_COMMAND} -E create_symlink |
| 221 | \"${PNGLIB_NAME}-config\" |
| 222 | \"libpng-config\") |
| 223 | ") |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 224 | |
| 225 | # SET UP LINKS |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 226 | if(PNG_SHARED) |
| 227 | set_target_properties(${PNG_LIB_NAME} PROPERTIES |
Glenn Randers-Pehrson | 8c03730 | 2010-08-23 17:07:32 -0500 | [diff] [blame^] | 228 | # VERSION 15.${PNGLIB_RELEASE}.1.5.0beta44 |
Glenn Randers-Pehrson | f1eb918 | 2010-02-08 15:36:41 -0600 | [diff] [blame] | 229 | VERSION 15.${PNGLIB_RELEASE}.0 |
| 230 | SOVERSION 15 |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 231 | CLEAN_DIRECT_OUTPUT 1) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 232 | endif() |
Glenn Randers-Pehrson glennrp@comcast.net | 7ecf7bd | 2009-05-02 15:36:08 -0500 | [diff] [blame] | 233 | if(PNG_STATIC) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 234 | if(NOT WIN32) |
| 235 | # that's uncool on win32 - it overwrites our static import lib... |
| 236 | set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 237 | OUTPUT_NAME ${PNG_LIB_NAME} |
| 238 | CLEAN_DIRECT_OUTPUT 1) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 239 | endif() |
| 240 | endif() |
| 241 | |
| 242 | # INSTALL |
| 243 | if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 244 | if(PNG_SHARED) |
| 245 | install(TARGETS ${PNG_LIB_NAME} |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 246 | RUNTIME DESTINATION bin |
Glenn Randers-Pehrson | 8c03730 | 2010-08-23 17:07:32 -0500 | [diff] [blame^] | 247 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 248 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
| 249 | install(CODE " |
| 250 | MESSAGE(STATUS \"Symlinking ${PNGLIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to libpng${CMAKE_SHARED_LIBRARY_SUFFIX}\") |
| 251 | execute_process(COMMAND \${CMAKE_COMMAND} -E create_symlink |
| 252 | \"${PNGLIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}\" |
| 253 | \"libpng${CMAKE_SHARED_LIBRARY_SUFFIX}\") |
| 254 | ") |
| 255 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 256 | endif() |
| 257 | if(PNG_STATIC) |
| 258 | install(TARGETS ${PNG_LIB_NAME_STATIC} |
Glenn Randers-Pehrson | 8c03730 | 2010-08-23 17:07:32 -0500 | [diff] [blame^] | 259 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 260 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
| 261 | install(CODE " |
| 262 | MESSAGE(STATUS \"Symlinking ${PNGLIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX} to libpng${CMAKE_STATIC_LIBRARY_SUFFIX}\") |
| 263 | execute_process(COMMAND \${CMAKE_COMMAND} -E create_symlink |
| 264 | \"${PNGLIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}\" |
| 265 | \"libpng${CMAKE_STATIC_LIBRARY_SUFFIX}\") |
| 266 | ") |
| 267 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 268 | endif() |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 269 | endif() |
| 270 | |
| 271 | if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL ) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 272 | install(FILES png.h pngconf.h DESTINATION include) |
| 273 | install(FILES png.h pngconf.h DESTINATION include/${PNGLIB_NAME}) |
Glenn Randers-Pehrson | ee35abb | 2009-10-30 15:42:54 -0500 | [diff] [blame] | 274 | endif() |
| 275 | if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL ) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 276 | install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin) |
| 277 | install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config |
| 278 | DESTINATION bin) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 279 | endif() |
| 280 | if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 281 | # Install man pages |
Glenn Randers-Pehrson | 8c03730 | 2010-08-23 17:07:32 -0500 | [diff] [blame^] | 282 | install(FILES libpng.3 libpngpf.3 DESTINATION share/man/man3) |
| 283 | install(FILES png.5 DESTINATION share/man/man5) |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 284 | # Install pkg-config files |
| 285 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc |
Glenn Randers-Pehrson | 8c03730 | 2010-08-23 17:07:32 -0500 | [diff] [blame^] | 286 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) |
| 287 | install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 288 | DESTINATION bin) |
| 289 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc |
Glenn Randers-Pehrson | 8c03730 | 2010-08-23 17:07:32 -0500 | [diff] [blame^] | 290 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) |
| 291 | install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config |
Glenn Randers-Pehrson | e3f3c4e | 2010-02-07 18:08:50 -0600 | [diff] [blame] | 292 | DESTINATION bin) |
Glenn Randers-Pehrson | 38e467e | 2009-08-27 15:59:40 -0500 | [diff] [blame] | 293 | endif() |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 294 | |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 295 | # what's with libpng.txt and all the extra files? |
| 296 | |
| 297 | |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 298 | # UNINSTALL |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 299 | # do we need this? |
| 300 | |
| 301 | |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 302 | # DIST |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 303 | # do we need this? |
| 304 | |
| 305 | # to create msvc import lib for mingw compiled shared lib |
| 306 | # pexports libpng.dll > libpng.def |
| 307 | # lib /def:libpng.def /machine:x86 |
Glenn Randers-Pehrson glennrp@comcast.net | 7ecf7bd | 2009-05-02 15:36:08 -0500 | [diff] [blame] | 308 | |