2011-08-17 10:46:29 -04:00
|
|
|
# CMakeLists.txt
|
|
|
|
|
2013-06-05 12:41:44 -04:00
|
|
|
# Copyright (C) 2007-2013 Glenn Randers-Pehrson
|
2011-08-17 10:46:29 -04:00
|
|
|
|
|
|
|
# This code is released under the libpng license.
|
|
|
|
# For conditions of distribution and use, see the disclaimer
|
|
|
|
# and license in png.h
|
|
|
|
|
2010-10-02 22:25:01 -04:00
|
|
|
cmake_minimum_required(VERSION 2.4.4)
|
2010-02-07 19:08:50 -05:00
|
|
|
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
|
|
|
|
2013-06-05 12:07:01 -04:00
|
|
|
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
|
|
|
|
|
2010-02-07 19:08:50 -05:00
|
|
|
project(libpng C)
|
2009-10-30 16:42:54 -04:00
|
|
|
enable_testing()
|
2006-12-07 20:16:44 -05:00
|
|
|
|
2007-05-15 17:16:34 -04:00
|
|
|
set(PNGLIB_MAJOR 1)
|
2011-11-23 16:28:01 -05:00
|
|
|
set(PNGLIB_MINOR 6)
|
2013-07-20 20:36:21 -04:00
|
|
|
set(PNGLIB_RELEASE 4)
|
2007-05-15 17:16:34 -04:00
|
|
|
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
|
|
|
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
2006-12-07 20:16:44 -05:00
|
|
|
|
|
|
|
# needed packages
|
|
|
|
find_package(ZLIB REQUIRED)
|
2009-08-27 16:59:40 -04:00
|
|
|
include_directories(${ZLIB_INCLUDE_DIR})
|
|
|
|
|
2007-05-15 17:16:34 -04:00
|
|
|
if(NOT WIN32)
|
2010-02-07 19:08:50 -05:00
|
|
|
find_library(M_LIBRARY
|
|
|
|
NAMES m
|
|
|
|
PATHS /usr/lib /usr/local/lib
|
|
|
|
)
|
|
|
|
if(NOT M_LIBRARY)
|
|
|
|
message(STATUS
|
|
|
|
"math library 'libm' not found - floating point support disabled")
|
|
|
|
endif()
|
2009-08-27 16:59:40 -04:00
|
|
|
else()
|
2010-02-07 19:08:50 -05:00
|
|
|
# not needed on windows
|
|
|
|
set(M_LIBRARY "")
|
2009-08-27 16:59:40 -04:00
|
|
|
endif()
|
2006-12-07 20:16:44 -05:00
|
|
|
|
2007-05-15 17:16:34 -04:00
|
|
|
# COMMAND LINE OPTIONS
|
2009-08-27 16:59:40 -04:00
|
|
|
if(DEFINED PNG_SHARED)
|
|
|
|
option(PNG_SHARED "Build shared lib" ${PNG_SHARED})
|
|
|
|
else()
|
|
|
|
option(PNG_SHARED "Build shared lib" ON)
|
|
|
|
endif()
|
|
|
|
if(DEFINED PNG_STATIC)
|
|
|
|
option(PNG_STATIC "Build static lib" ${PNG_STATIC})
|
|
|
|
else()
|
|
|
|
option(PNG_STATIC "Build static lib" ON)
|
|
|
|
endif()
|
|
|
|
|
2011-09-27 20:01:58 -04:00
|
|
|
option(PNG_TESTS "Build libpng tests" YES)
|
2009-08-27 16:59:40 -04:00
|
|
|
|
2011-09-27 20:01:58 -04:00
|
|
|
# Many more configuration options could be added here
|
2009-08-27 16:59:40 -04:00
|
|
|
option(PNG_DEBUG "Build with debug output" NO)
|
2011-09-27 20:01:58 -04:00
|
|
|
option(PNGARG "Disable ANSI-C prototypes" NO)
|
2006-12-07 20:16:44 -05:00
|
|
|
|
2007-05-15 17:16:34 -04:00
|
|
|
# SET LIBNAME
|
2010-10-02 22:25:01 -04:00
|
|
|
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
2006-12-07 20:16:44 -05:00
|
|
|
|
|
|
|
# to distinguish between debug and release lib
|
|
|
|
set(CMAKE_DEBUG_POSTFIX "d")
|
|
|
|
|
2010-10-02 22:25:01 -04:00
|
|
|
# Use the prebuilt pnglibconf.h file from the scripts folder
|
2011-09-27 20:01:58 -04:00
|
|
|
# TODO: fix this by building with awk; without this no cmake build can be
|
|
|
|
# configured directly (to do so indirectly use your local awk to build a
|
|
|
|
# pnglibconf.h in the build directory.)
|
2010-10-02 22:25:01 -04:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
|
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
2006-12-07 20:16:44 -05:00
|
|
|
|
2007-05-15 17:16:34 -04:00
|
|
|
# OUR SOURCES
|
2010-10-02 22:25:01 -04:00
|
|
|
set(libpng_public_hdrs
|
2010-02-07 19:08:50 -05:00
|
|
|
png.h
|
|
|
|
pngconf.h
|
2010-10-02 22:25:01 -04:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h
|
|
|
|
)
|
|
|
|
set(libpng_sources
|
|
|
|
${libpng_public_hdrs}
|
2010-08-26 18:11:55 -04:00
|
|
|
pngdebug.h
|
|
|
|
pnginfo.h
|
2010-10-02 22:25:01 -04:00
|
|
|
pngpriv.h
|
2010-08-26 18:11:55 -04:00
|
|
|
pngstruct.h
|
2010-02-07 19:08:50 -05:00
|
|
|
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
|
2006-12-07 20:16:44 -05:00
|
|
|
)
|
|
|
|
set(pngtest_sources
|
2010-02-07 19:08:50 -05:00
|
|
|
pngtest.c
|
2006-12-07 20:16:44 -05:00
|
|
|
)
|
2011-09-27 20:01:58 -04:00
|
|
|
set(pngvalid_sources
|
2011-12-08 10:53:00 -05:00
|
|
|
contrib/libtests/pngvalid.c
|
|
|
|
)
|
|
|
|
set(pngstest_sources
|
|
|
|
contrib/libtests/pngstest.c
|
2011-09-27 20:01:58 -04:00
|
|
|
)
|
2007-05-15 17:16:34 -04:00
|
|
|
# SOME NEEDED DEFINITIONS
|
2009-11-07 13:02:48 -05:00
|
|
|
|
2006-12-07 20:16:44 -05:00
|
|
|
if(MSVC)
|
2011-09-27 20:01:58 -04:00
|
|
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
2006-12-07 20:16:44 -05:00
|
|
|
endif(MSVC)
|
|
|
|
|
2007-05-15 17:16:34 -04:00
|
|
|
if(PNG_DEBUG)
|
2010-08-23 18:07:32 -04:00
|
|
|
add_definitions(-DPNG_DEBUG)
|
2009-08-27 16:59:40 -04:00
|
|
|
endif()
|
2007-05-15 17:16:34 -04:00
|
|
|
|
|
|
|
# NOW BUILD OUR TARGET
|
2010-02-07 19:08:50 -05:00
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
|
2006-12-07 20:16:44 -05:00
|
|
|
|
2013-03-07 12:17:17 -05:00
|
|
|
unset(PNG_LIB_TARGETS)
|
|
|
|
|
2006-12-07 20:16:44 -05:00
|
|
|
if(PNG_SHARED)
|
2010-02-07 19:08:50 -05:00
|
|
|
add_library(${PNG_LIB_NAME} SHARED ${libpng_sources})
|
2013-03-07 12:17:17 -05:00
|
|
|
set(PNG_LIB_TARGETS ${PNG_LIB_NAME})
|
2010-02-07 19:08:50 -05:00
|
|
|
if(MSVC)
|
|
|
|
# msvc does not append 'lib' - do it here to have consistent name
|
|
|
|
set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib")
|
2010-10-02 22:25:01 -04:00
|
|
|
set_target_properties(${PNG_LIB_NAME} PROPERTIES IMPORT_PREFIX "lib")
|
2010-02-07 19:08:50 -05:00
|
|
|
endif()
|
|
|
|
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
2009-08-27 16:59:40 -04:00
|
|
|
endif()
|
|
|
|
|
2007-05-15 17:16:34 -04:00
|
|
|
if(PNG_STATIC)
|
|
|
|
# does not work without changing name
|
2010-02-07 19:08:50 -05:00
|
|
|
set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static)
|
|
|
|
add_library(${PNG_LIB_NAME_STATIC} STATIC ${libpng_sources})
|
2013-03-07 12:17:17 -05:00
|
|
|
list(APPEND PNG_LIB_TARGETS ${PNG_LIB_NAME_STATIC})
|
2010-02-07 19:08:50 -05:00
|
|
|
if(MSVC)
|
|
|
|
# msvc does not append 'lib' - do it here to have consistent name
|
|
|
|
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib")
|
|
|
|
endif()
|
2010-10-02 22:25:01 -04:00
|
|
|
target_link_libraries(${PNG_LIB_NAME_STATIC} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
2009-08-27 16:59:40 -04:00
|
|
|
endif()
|
|
|
|
|
2013-03-07 12:17:17 -05:00
|
|
|
if(NOT PNG_LIB_TARGETS)
|
|
|
|
message(SEND_ERROR
|
|
|
|
"No library variant selected to build. "
|
|
|
|
"Please enable at least one of the following options: PNG_STATIC, PNG_SHARED")
|
|
|
|
endif()
|
|
|
|
|
2006-12-07 20:16:44 -05:00
|
|
|
if(PNG_SHARED AND WIN32)
|
2010-02-07 19:08:50 -05:00
|
|
|
set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
|
2009-08-27 16:59:40 -04:00
|
|
|
endif()
|
2006-12-07 20:16:44 -05:00
|
|
|
|
2009-08-27 16:59:40 -04:00
|
|
|
if(PNG_TESTS AND PNG_SHARED)
|
2010-02-07 19:08:50 -05:00
|
|
|
# does not work with msvc due to png_lib_ver issue
|
|
|
|
add_executable(pngtest ${pngtest_sources})
|
|
|
|
target_link_libraries(pngtest ${PNG_LIB_NAME})
|
2010-10-02 22:25:01 -04:00
|
|
|
add_test(pngtest ./pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png)
|
2011-09-27 20:01:58 -04:00
|
|
|
#
|
|
|
|
add_executable(pngvalid ${pngvalid_sources})
|
|
|
|
target_link_libraries(pngvalid ${PNG_LIB_NAME})
|
|
|
|
add_test(pngvalid ./pngvalid)
|
2011-12-08 10:53:00 -05:00
|
|
|
add_executable(pngstest ${pngstest_sources})
|
|
|
|
target_link_libraries(pngstest ${PNG_LIB_NAME})
|
|
|
|
add_test(pngstest ./pngstest
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g01.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g02.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g04.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g08.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g16.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn2c08.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn2c16.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p01.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p02.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p04.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p08.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn4a08.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn4a16.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn6a08.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn6a16.png
|
2013-03-02 15:58:22 -05:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g01.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g02.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g04.png
|
2011-12-08 10:53:00 -05:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn2c16.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn3p08.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbgn2c16.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbgn3p08.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbrn2c08.png
|
2013-03-02 15:58:22 -05:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbwn0g16.png
|
2011-12-08 10:53:00 -05:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbwn3p08.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbyn3p08.png
|
2013-03-02 15:58:22 -05:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n0g08.png
|
2011-12-08 10:53:00 -05:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n2c08.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n3p08.png
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp1n3p08.png
|
|
|
|
)
|
2009-08-27 16:59:40 -04:00
|
|
|
endif()
|
2006-12-07 20:16:44 -05:00
|
|
|
|
2011-08-17 10:02:07 -04:00
|
|
|
# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set
|
|
|
|
IF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
2013-03-02 15:58:22 -05:00
|
|
|
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib")
|
2011-08-17 10:02:07 -04:00
|
|
|
ENDIF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
|
|
|
|
2010-10-02 22:25:01 -04:00
|
|
|
# Set a variable with CMake code which:
|
|
|
|
# Creates a symlink from src to dest (if possible) or alternatively
|
|
|
|
# copies if different.
|
2011-07-27 21:47:13 -04:00
|
|
|
macro(CREATE_SYMLINK SRC_FILE DEST_FILE)
|
2011-08-17 10:46:29 -04:00
|
|
|
FILE(REMOVE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
|
2013-03-02 15:58:22 -05:00
|
|
|
if(WIN32 AND NOT CYGWIN AND NOT MSYS)
|
2011-08-17 10:46:29 -04:00
|
|
|
ADD_CUSTOM_COMMAND(
|
|
|
|
OUTPUT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
|
2013-03-07 12:17:17 -05:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SRC_FILE}" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SRC_FILE}" ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
|
|
|
|
DEPENDS ${PNG_LIB_TARGETS}
|
2011-08-17 10:46:29 -04:00
|
|
|
)
|
|
|
|
ADD_CUSTOM_TARGET(${DEST_FILE}_COPY ALL DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
|
2013-03-02 15:58:22 -05:00
|
|
|
else(WIN32 AND NOT CYGWIN AND NOT MSYS)
|
2013-03-07 12:17:17 -05:00
|
|
|
get_filename_component(LINK_TARGET "${SRC_FILE}" NAME)
|
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${LINK_TARGET}" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${LINK_TARGET}" ${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
2013-03-02 15:58:22 -05:00
|
|
|
endif(WIN32 AND NOT CYGWIN AND NOT MSYS)
|
2010-10-02 22:25:01 -04:00
|
|
|
endmacro()
|
2006-12-07 20:16:44 -05:00
|
|
|
|
2011-09-27 20:01:58 -04:00
|
|
|
# libpng is a library so default to 'lib'
|
2010-08-23 18:07:32 -04:00
|
|
|
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
2011-01-14 18:08:28 -05:00
|
|
|
set(CMAKE_INSTALL_LIBDIR lib)
|
2010-08-23 18:07:32 -04:00
|
|
|
endif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
2011-09-27 20:01:58 -04:00
|
|
|
|
|
|
|
# CREATE PKGCONFIG FILES
|
|
|
|
# we use the same files like ./configure, so we have to set its vars
|
|
|
|
# Only do this on Windows for Cygwin - the files don't make much sense outside
|
|
|
|
# a UNIX look alike
|
2013-03-02 15:58:22 -05:00
|
|
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
|
|
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
|
|
|
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
|
|
|
set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
|
|
|
|
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
|
|
|
|
set(LIBS "-lz -lm")
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
|
|
|
|
CREATE_SYMLINK(${PNGLIB_NAME}.pc libpng.pc)
|
|
|
|
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
|
|
|
|
CREATE_SYMLINK(${PNGLIB_NAME}-config libpng-config)
|
2011-11-21 13:37:13 -05:00
|
|
|
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
2007-05-15 17:16:34 -04:00
|
|
|
|
|
|
|
# SET UP LINKS
|
2009-08-27 16:59:40 -04:00
|
|
|
if(PNG_SHARED)
|
|
|
|
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
2013-09-05 16:11:27 -04:00
|
|
|
# VERSION 16.${PNGLIB_RELEASE}.1.6.4rc01
|
2011-11-24 15:40:36 -05:00
|
|
|
VERSION 16.${PNGLIB_RELEASE}.0
|
|
|
|
SOVERSION 16
|
2010-02-07 19:08:50 -05:00
|
|
|
CLEAN_DIRECT_OUTPUT 1)
|
2009-08-27 16:59:40 -04:00
|
|
|
endif()
|
2009-05-02 16:36:08 -04:00
|
|
|
if(PNG_STATIC)
|
2010-10-02 22:25:01 -04:00
|
|
|
# MSVC doesn't use a different file extension for shared vs. static
|
|
|
|
# libs. We are able to change OUTPUT_NAME to remove the _static
|
|
|
|
# for all other platforms.
|
|
|
|
if(NOT MSVC)
|
2009-08-27 16:59:40 -04:00
|
|
|
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
|
2010-02-07 19:08:50 -05:00
|
|
|
OUTPUT_NAME ${PNG_LIB_NAME}
|
|
|
|
CLEAN_DIRECT_OUTPUT 1)
|
2009-08-27 16:59:40 -04:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2010-10-02 22:25:01 -04:00
|
|
|
# If CMake > 2.4.x, we set a variable used below to export
|
|
|
|
# targets to an export file.
|
|
|
|
# TODO: Use VERSION_GREATER after our cmake_minimum_required >= 2.6.2
|
|
|
|
if(CMAKE_MAJOR_VERSION GREATER 1 AND CMAKE_MINOR_VERSION GREATER 4)
|
|
|
|
set(PNG_EXPORT_RULE EXPORT libpng)
|
|
|
|
elseif(CMAKE_MAJOR_VERSION GREATER 2) # future proof
|
|
|
|
set(PNG_EXPORT_RULE EXPORT libpng)
|
|
|
|
endif()
|
|
|
|
|
2009-08-27 16:59:40 -04:00
|
|
|
# INSTALL
|
|
|
|
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
2013-03-07 12:17:17 -05:00
|
|
|
install(TARGETS ${PNG_LIB_TARGETS}
|
|
|
|
${PNG_EXPORT_RULE}
|
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
2010-10-02 22:25:01 -04:00
|
|
|
|
2013-03-07 12:17:17 -05:00
|
|
|
if(PNG_SHARED)
|
2011-11-24 15:40:36 -05:00
|
|
|
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
|
2011-11-21 13:37:13 -05:00
|
|
|
if(CYGWIN OR MINGW)
|
2011-08-17 10:46:29 -04:00
|
|
|
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
|
2013-03-07 12:17:17 -05:00
|
|
|
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
|
2011-08-17 10:46:29 -04:00
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
2011-11-21 13:37:13 -05:00
|
|
|
endif(CYGWIN OR MINGW)
|
2010-10-02 22:25:01 -04:00
|
|
|
|
|
|
|
if(NOT WIN32)
|
2011-08-17 10:46:29 -04:00
|
|
|
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
|
2013-03-07 12:17:17 -05:00
|
|
|
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
|
2011-08-17 10:46:29 -04:00
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
2011-07-27 21:47:13 -04:00
|
|
|
endif(NOT WIN32)
|
|
|
|
endif(PNG_SHARED)
|
2010-10-02 22:25:01 -04:00
|
|
|
|
2010-02-07 19:08:50 -05:00
|
|
|
if(PNG_STATIC)
|
2011-11-21 13:37:13 -05:00
|
|
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
2011-08-17 10:46:29 -04:00
|
|
|
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME_STATIC} LOCATION_${CMAKE_BUILD_TYPE})
|
2013-03-07 12:17:17 -05:00
|
|
|
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
|
2011-08-17 10:46:29 -04:00
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
2011-11-21 13:37:13 -05:00
|
|
|
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
2011-07-27 21:47:13 -04:00
|
|
|
endif()
|
2009-08-27 16:59:40 -04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
|
2010-10-02 22:25:01 -04:00
|
|
|
install(FILES ${libpng_public_hdrs} DESTINATION include)
|
|
|
|
install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME})
|
2009-10-30 16:42:54 -04:00
|
|
|
endif()
|
|
|
|
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
|
2013-03-02 15:58:22 -05:00
|
|
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
|
|
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
|
|
|
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
|
|
|
DESTINATION bin)
|
|
|
|
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
2009-08-27 16:59:40 -04:00
|
|
|
endif()
|
2013-03-02 15:58:22 -05:00
|
|
|
|
2009-08-27 16:59:40 -04:00
|
|
|
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
2010-02-07 19:08:50 -05:00
|
|
|
# Install man pages
|
2010-10-02 22:25:01 -04:00
|
|
|
if(NOT PNG_MAN_DIR)
|
|
|
|
set(PNG_MAN_DIR "share/man")
|
|
|
|
endif()
|
|
|
|
install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3)
|
|
|
|
install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5)
|
2010-02-07 19:08:50 -05:00
|
|
|
# Install pkg-config files
|
2013-03-02 15:58:22 -05:00
|
|
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
|
|
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
|
|
|
|
DESTINATION bin)
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
|
|
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
|
|
|
DESTINATION bin)
|
|
|
|
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
2009-08-27 16:59:40 -04:00
|
|
|
endif()
|
2007-05-15 17:16:34 -04:00
|
|
|
|
2010-10-02 22:25:01 -04:00
|
|
|
# On versions of CMake that support it, create an export file CMake
|
|
|
|
# users can include() to import our targets
|
|
|
|
if(PNG_EXPORT_RULE AND NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL )
|
|
|
|
install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake)
|
|
|
|
endif()
|
|
|
|
|
2011-01-14 18:08:28 -05:00
|
|
|
# what's with libpng-$VER%.txt and all the extra files?
|
2006-12-07 20:16:44 -05:00
|
|
|
|
2007-05-15 17:16:34 -04:00
|
|
|
# UNINSTALL
|
2006-12-07 20:16:44 -05:00
|
|
|
# do we need this?
|
|
|
|
|
2007-05-15 17:16:34 -04:00
|
|
|
# DIST
|
2006-12-07 20:16:44 -05:00
|
|
|
# do we need this?
|
|
|
|
|
|
|
|
# to create msvc import lib for mingw compiled shared lib
|
|
|
|
# pexports libpng.dll > libpng.def
|
|
|
|
# lib /def:libpng.def /machine:x86
|
2009-05-02 16:36:08 -04:00
|
|
|
|