Clean up CMakeLists.txt

* Rename the target `png` to `png_shared`. The main targets are now
   named `png_shared`, `png_static` and `png_framework`.
 * Rename the function symbol_prefix() to find_symbol_prefix().
 * Rename the prefix `S` to `_SYM` in the function create_symlink().
 * Rewrite the precondition checks in the function create_symlink().
 * Add precondition checks to the function generate_copy().
 * Delete the vestigial property CLEAN_DIRECT_OUTPUT.
 * Delete the variables PNG_LIB_NAME_STATIC and PNG_LIB_NAME_FRAMEWORK.
 * Initialize and use PNG_LIB_TARGETS consistently as a list.
 * Move all include() commands to the top of the file.
 * Acknowledge a former contributor.
 * Reformat.
This commit is contained in:
Cosmin Truta 2023-02-08 19:44:31 +02:00
parent efa9c2e920
commit aab24fa1b3

View File

@ -5,6 +5,7 @@
# Written by Christian Ehrlicher, 2007
# Revised by Roger Lowman, 2009-2010
# Revised by Clifford Yapp, 2011-2012,2017
# Revised by Claudio Bley, 2013
# Revised by Roger Leigh, 2016
# Revised by Andreas Franek, 2016
# Revised by Sam Serrels, 2017
@ -34,6 +35,10 @@ cmake_policy(VERSION 3.1)
project(libpng C ASM)
enable_testing()
include(CMakeParseArguments)
include(CheckCSourceCompiles)
include(GNUInstallDirs)
set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 6)
set(PNGLIB_REVISION 40)
@ -44,8 +49,6 @@ set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_REVISION})
set(PNGLIB_SHARED_SOVERSION ${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_SHARED_VERSION ${PNGLIB_SHARED_SOVERSION}.${PNGLIB_REVISION}.${PNGLIB_SUBREVISION})
include(GNUInstallDirs)
# Allow users to specify location of zlib.
# Useful if zlib is being built alongside this as a sub-project.
option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" OFF)
@ -229,13 +232,12 @@ set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
# Distinguish between debug and release builds.
set(CMAKE_DEBUG_POSTFIX "d")
include(CheckCSourceCompiles)
option(ld-version-script "Enable linker version script" ON)
if(ld-version-script AND NOT ANDROID AND NOT APPLE)
# Check if LD supports linker scripts.
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "
VERS_1 {
global: sym;
global: sym1;
local: *;
};
@ -249,7 +251,8 @@ VERS_2 {
${CMAKE_REQUIRED_FLAGS}
${CMAKE_SHARED_LIBRARY_C_FLAGS}
"-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/conftest.map'")
check_c_source_compiles("void sym(void) {}
check_c_source_compiles("
void sym1(void) {}
void sym2(void) {}
int main(void) {return 0;}
" HAVE_LD_VERSION_SCRIPT)
@ -258,7 +261,8 @@ int main(void) {return 0;}
${CMAKE_REQUIRED_FLAGS_SAVE}
${CMAKE_SHARED_LIBRARY_C_FLAGS}
"-Wl,-M -Wl,${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
check_c_source_compiles("void sym(void) {}
check_c_source_compiles("
void sym1(void) {}
void sym2(void) {}
int main(void) {return 0;}
" HAVE_SOLARIS_LD_VERSION_SCRIPT)
@ -269,10 +273,10 @@ endif()
# Find symbol prefix. Likely obsolete and unnecessary with recent
# toolchains (it's not done in many other projects).
function(symbol_prefix)
function(find_symbol_prefix)
set(SYMBOL_PREFIX)
execute_process(COMMAND "${CMAKE_C_COMPILER}" "-E" "-"
execute_process(COMMAND "${CMAKE_C_COMPILER}" -E -
INPUT_FILE /dev/null
OUTPUT_VARIABLE OUT
RESULT_VARIABLE STATUS)
@ -299,7 +303,7 @@ function(symbol_prefix)
endfunction()
if(UNIX)
symbol_prefix()
find_symbol_prefix()
endif()
find_program(AWK NAMES gawk awk)
@ -310,7 +314,7 @@ if(NOT AWK OR ANDROID OR IOS)
# No awk available to generate sources; use pre-built pnglibconf.h
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
add_custom_target(png_genfiles) # Dummy
add_custom_target(png_genfiles)
else()
# Copy the awk scripts, converting their line endings to Unix (LF)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/checksym.awk
@ -328,7 +332,6 @@ else()
# Generate .chk from .out with awk:
# generate_chk(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]])
include(CMakeParseArguments)
function(generate_chk)
set(options)
set(oneValueArgs INPUT OUTPUT)
@ -399,6 +402,13 @@ else()
set(oneValueArgs INPUT OUTPUT)
set(multiValueArgs DEPENDS)
cmake_parse_arguments(_GCO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT _GCO_INPUT)
message(FATAL_ERROR "generate_copy: Missing INPUT argument")
endif()
if(NOT _GCO_OUTPUT)
message(FATAL_ERROR "generate_copy: Missing OUTPUT argument")
endif()
add_custom_command(OUTPUT "${_GCO_OUTPUT}"
COMMAND "${CMAKE_COMMAND}"
-E remove "${_GCO_OUTPUT}"
@ -412,14 +422,16 @@ else()
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa"
"${CMAKE_CURRENT_BINARY_DIR}/scripts/options.awk"
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h")
add_custom_target(png_scripts_pnglibconf_c DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/pnglibconf.c")
add_custom_target(png_scripts_pnglibconf_c
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/pnglibconf.c")
# Generate pnglibconf.c
generate_source(OUTPUT "pnglibconf.c"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa"
"${CMAKE_CURRENT_BINARY_DIR}/scripts/options.awk"
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h")
add_custom_target(pnglibconf_c DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c")
add_custom_target(pnglibconf_c
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c")
if(PNG_PREFIX)
set(PNGLIBCONF_H_EXTRA_DEPENDS
@ -432,49 +444,57 @@ else()
generate_out(INPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out"
DEPENDS pnglibconf_c)
add_custom_target(pnglibconf_out DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out")
add_custom_target(pnglibconf_out
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out")
# Generate pnglibconf.h
generate_source(OUTPUT "pnglibconf.h"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out" pnglibconf_out
${PNGLIBCONF_H_EXTRA_DEPENDS})
add_custom_target(pnglibconf_h DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
add_custom_target(pnglibconf_h
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/intprefix.c"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h" pnglibconf_h)
add_custom_target(png_scripts_intprefix_out DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out")
add_custom_target(png_scripts_intprefix_out
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out")
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/prefix.c"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out" pnglibconf_out)
add_custom_target(png_scripts_prefix_out DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out")
add_custom_target(png_scripts_prefix_out
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out")
# Generate pngprefix.h
generate_source(OUTPUT "pngprefix.h"
DEPENDS ${PNGPREFIX_H_EXTRA_DEPENDS})
add_custom_target(pngprefix_h DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h")
add_custom_target(pngprefix_h
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h")
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/sym.c"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h" pnglibconf_h)
add_custom_target(png_scripts_sym_out DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out")
add_custom_target(png_scripts_sym_out
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out")
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.c"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt")
add_custom_target(png_scripts_symbols_out DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out")
add_custom_target(png_scripts_symbols_out
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out")
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/vers.c"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h" pnglibconf_h)
add_custom_target(png_scripts_vers_out DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out")
add_custom_target(png_scripts_vers_out
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out")
generate_chk(INPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk"
@ -591,49 +611,48 @@ endif()
# Now build our target.
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIRS})
unset(PNG_LIB_TARGETS)
set(PNG_LIB_TARGETS "")
if(PNG_SHARED)
add_library(png SHARED ${libpng_sources})
set(PNG_LIB_TARGETS png)
set_target_properties(png PROPERTIES OUTPUT_NAME ${PNG_LIB_NAME})
add_dependencies(png png_genfiles)
add_library(png_shared SHARED ${libpng_sources})
add_dependencies(png_shared png_genfiles)
list(APPEND PNG_LIB_TARGETS png_shared)
set_target_properties(png_shared PROPERTIES OUTPUT_NAME ${PNG_LIB_NAME})
if(MSVC)
# MVC does not append 'lib'. Do it here, to have consistent name.
set_target_properties(png PROPERTIES PREFIX "lib")
set_target_properties(png PROPERTIES IMPORT_PREFIX "lib")
# MSVC does not append 'lib'. Do it here, to have consistent names.
set_target_properties(png_shared PROPERTIES PREFIX "lib")
set_target_properties(png_shared PROPERTIES IMPORT_PREFIX "lib")
endif()
target_link_libraries(png ${ZLIB_LIBRARIES} ${M_LIBRARY})
target_link_libraries(png_shared ${ZLIB_LIBRARIES} ${M_LIBRARY})
if(UNIX AND AWK)
if(HAVE_LD_VERSION_SCRIPT)
set_target_properties(png PROPERTIES
set_target_properties(png_shared PROPERTIES
LINK_FLAGS "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/libpng.vers'")
elseif(HAVE_SOLARIS_LD_VERSION_SCRIPT)
set_target_properties(png PROPERTIES
set_target_properties(png_shared PROPERTIES
LINK_FLAGS "-Wl,-M -Wl,'${CMAKE_CURRENT_BINARY_DIR}/libpng.vers'")
endif()
endif()
if(WIN32)
set_target_properties(png_shared PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
endif()
endif()
if(PNG_STATIC)
# does not work without changing name
set(PNG_LIB_NAME_STATIC png_static)
add_library(png_static STATIC ${libpng_sources})
add_dependencies(png_static png_genfiles)
list(APPEND PNG_LIB_TARGETS png_static)
# 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)
set_target_properties(png_static PROPERTIES
OUTPUT_NAME "${PNG_LIB_NAME}"
CLEAN_DIRECT_OUTPUT 1)
OUTPUT_NAME "${PNG_LIB_NAME}")
else()
set_target_properties(png_static PROPERTIES
OUTPUT_NAME "${PNG_LIB_NAME}_static"
CLEAN_DIRECT_OUTPUT 1)
OUTPUT_NAME "${PNG_LIB_NAME}_static")
endif()
list(APPEND PNG_LIB_TARGETS png_static)
if(MSVC)
# MSVC does not append 'lib'. Do it here, to have consistent name.
set_target_properties(png_static PROPERTIES PREFIX "lib")
@ -642,7 +661,6 @@ if(PNG_STATIC)
endif()
if(PNG_FRAMEWORK)
set(PNG_LIB_NAME_FRAMEWORK png_framework)
add_library(png_framework SHARED ${libpng_sources})
add_dependencies(png_framework png_genfiles)
list(APPEND PNG_LIB_TARGETS png_framework)
@ -661,12 +679,7 @@ endif()
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, PNG_FRAMEWORK")
endif()
if(PNG_SHARED AND WIN32)
set_target_properties(png PROPERTIES
DEFINE_SYMBOL PNG_BUILD_DLL)
"PNG_SHARED, PNG_STATIC, PNG_FRAMEWORK")
endif()
function(png_add_test)
@ -674,7 +687,6 @@ function(png_add_test)
set(oneValueArgs NAME COMMAND)
set(multiValueArgs OPTIONS FILES)
cmake_parse_arguments(_PAT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT _PAT_NAME)
message(FATAL_ERROR "png_add_test: Missing NAME argument")
endif()
@ -690,7 +702,7 @@ function(png_add_test)
@ONLY)
add_test(NAME "${_PAT_NAME}"
COMMAND "${CMAKE_COMMAND}"
"-DLIBPNG=$<TARGET_FILE:png>"
"-DLIBPNG=$<TARGET_FILE:png_shared>"
"-DTEST_COMMAND=$<TARGET_FILE:${_PAT_COMMAND}>"
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
endfunction()
@ -706,14 +718,14 @@ if(PNG_TESTS AND PNG_SHARED)
set(PNGTEST_PNG "${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png")
add_executable(pngtest ${pngtest_sources})
target_link_libraries(pngtest png)
target_link_libraries(pngtest png_shared)
png_add_test(NAME pngtest
COMMAND pngtest
FILES "${PNGTEST_PNG}")
add_executable(pngvalid ${pngvalid_sources})
target_link_libraries(pngvalid png)
target_link_libraries(pngvalid png_shared)
png_add_test(NAME pngvalid-gamma-16-to-8
COMMAND pngvalid
@ -759,7 +771,7 @@ if(PNG_TESTS AND PNG_SHARED)
OPTIONS --transform)
add_executable(pngstest ${pngstest_sources})
target_link_libraries(pngstest png)
target_link_libraries(pngstest png_shared)
foreach(gamma_type 1.8 linear none sRGB)
foreach(alpha_type none alpha)
@ -814,7 +826,7 @@ if(PNG_TESTS AND PNG_SHARED)
endforeach()
add_executable(pngunknown ${pngunknown_sources})
target_link_libraries(pngunknown png)
target_link_libraries(pngunknown png_shared)
png_add_test(NAME pngunknown-discard
COMMAND pngunknown
@ -846,7 +858,7 @@ if(PNG_TESTS AND PNG_SHARED)
FILES "${PNGTEST_PNG}")
add_executable(pngimage ${pngimage_sources})
target_link_libraries(pngimage png)
target_link_libraries(pngimage png_shared)
png_add_test(NAME pngimage-quick
COMMAND pngimage
@ -860,7 +872,7 @@ endif()
if(PNG_SHARED AND PNG_EXECUTABLES)
add_executable(pngfix ${pngfix_sources})
target_link_libraries(pngfix png)
target_link_libraries(pngfix png_shared)
set(PNG_BIN_TARGETS pngfix)
add_executable(png-fix-itxt ${png_fix_itxt_sources})
@ -868,56 +880,53 @@ if(PNG_SHARED AND PNG_EXECUTABLES)
list(APPEND PNG_BIN_TARGETS png-fix-itxt)
endif()
# Creates a symlink from src to dest (if possible), or, alternatively,
# copies src to dest if different.
include(CMakeParseArguments)
# Create a symlink from src to dest (if possible), or, alternatively,
# copy src to dest if different.
function(create_symlink DEST_FILE)
cmake_parse_arguments(S "" "FILE;TARGET" "" ${ARGN})
if(NOT S_TARGET AND NOT S_FILE)
message(FATAL_ERROR "create_symlink: Missing TARGET or FILE argument")
cmake_parse_arguments(_SYM "" "FILE;TARGET" "" ${ARGN})
if(NOT _SYM_FILE AND NOT _SYM_TARGET)
message(FATAL_ERROR "create_symlink: Missing FILE or TARGET argument")
endif()
if(S_TARGET AND S_FILE)
if(_SYM_FILE AND _SYM_TARGET)
message(FATAL_ERROR "create_symlink: "
"Both source file ${S_FILE} and build target ${S_TARGET} arguments are present; "
"can only have one")
"The arguments FILE (${_SYM_FILE}) and TARGET (${_SYM_TARGET}) "
"are mutually-exclusive")
endif()
if(S_FILE)
if(_SYM_FILE)
# If we don't need to symlink something that's coming from a build target,
# we can go ahead and symlink/copy at configure time.
if(CMAKE_HOST_WIN32 AND NOT CYGWIN)
execute_process(COMMAND "${CMAKE_COMMAND}"
-E copy_if_different
${S_FILE} ${DEST_FILE}
${_SYM_FILE} ${DEST_FILE}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
else()
execute_process(COMMAND "${CMAKE_COMMAND}"
-E create_symlink
${S_FILE} ${DEST_FILE}
${_SYM_FILE} ${DEST_FILE}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endif()
endif()
if(S_TARGET)
if(_SYM_TARGET)
# We need to use generator expressions, which can be a bit tricky.
# For simplicity, make the symlink a POST_BUILD step, and use the TARGET
# signature of add_custom_command.
if(CMAKE_HOST_WIN32 AND NOT CYGWIN)
add_custom_command(TARGET ${S_TARGET}
add_custom_command(TARGET ${_SYM_TARGET}
POST_BUILD
COMMAND "${CMAKE_COMMAND}"
-E copy_if_different
$<TARGET_LINKER_FILE_NAME:${S_TARGET}>
$<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE})
$<TARGET_LINKER_FILE_NAME:${_SYM_TARGET}>
$<TARGET_LINKER_FILE_DIR:${_SYM_TARGET}>/${DEST_FILE})
else()
add_custom_command(TARGET ${S_TARGET}
add_custom_command(TARGET ${_SYM_TARGET}
POST_BUILD
COMMAND "${CMAKE_COMMAND}"
-E create_symlink
$<TARGET_LINKER_FILE_NAME:${S_TARGET}>
$<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE})
$<TARGET_LINKER_FILE_NAME:${_SYM_TARGET}>
$<TARGET_LINKER_FILE_DIR:${_SYM_TARGET}>/${DEST_FILE})
endif()
endif()
endfunction()
@ -960,10 +969,9 @@ endif()
# Set up links.
if(PNG_SHARED)
set_target_properties(png PROPERTIES
VERSION ${PNGLIB_SHARED_VERSION}
SOVERSION ${PNGLIB_SHARED_SOVERSION}
CLEAN_DIRECT_OUTPUT 1)
set_target_properties(png_shared PROPERTIES
VERSION ${PNGLIB_SHARED_VERSION}
SOVERSION ${PNGLIB_SHARED_SOVERSION})
endif()
# Install.
@ -978,14 +986,14 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
if(PNG_SHARED)
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
if(CYGWIN OR MINGW)
create_symlink(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png)
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
create_symlink(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png_shared)
install(FILES $<TARGET_LINKER_FILE_DIR:png_shared>/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT WIN32)
create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png)
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png_shared)
install(FILES $<TARGET_LINKER_FILE_DIR:png_shared>/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
endif()