[libpng16] Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation,
no longer using deprecated cmake LOCATION feature (Clifford Yapp).
This commit is contained in:
parent
d683af0f12
commit
9d4215e6c0
2
ANNOUNCE
2
ANNOUNCE
@ -66,6 +66,8 @@ Version 1.6.32beta08 [August 3, 2017]
|
|||||||
|
|
||||||
Version 1.6.32beta09 [August 3, 2017]
|
Version 1.6.32beta09 [August 3, 2017]
|
||||||
Temporarily disable IDAT length-limiting.
|
Temporarily disable IDAT length-limiting.
|
||||||
|
Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation,
|
||||||
|
no longer using deprecated cmake LOCATION feature (Clifford Yapp).
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
2
CHANGES
2
CHANGES
@ -5949,6 +5949,8 @@ Version 1.6.32beta08 [August 3, 2017]
|
|||||||
|
|
||||||
Version 1.6.32beta09 [August 3, 2017]
|
Version 1.6.32beta09 [August 3, 2017]
|
||||||
Temporarily disable IDAT length-limiting.
|
Temporarily disable IDAT length-limiting.
|
||||||
|
Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation,
|
||||||
|
no longer using deprecated cmake LOCATION feature (Clifford Yapp).
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
# For conditions of distribution and use, see the disclaimer
|
# For conditions of distribution and use, see the disclaimer
|
||||||
# and license in png.h
|
# and license in png.h
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.8.3)
|
cmake_minimum_required(VERSION 2.8.8)
|
||||||
cmake_policy(VERSION 2.8.3)
|
cmake_policy(VERSION 2.8.8)
|
||||||
|
|
||||||
# Set MacOSX @rpath usage globally.
|
# Set MacOSX @rpath usage globally.
|
||||||
if (POLICY CMP0020)
|
if (POLICY CMP0020)
|
||||||
@ -755,31 +755,58 @@ if(PNG_SHARED)
|
|||||||
list(APPEND PNG_BIN_TARGETS png-fix-itxt)
|
list(APPEND PNG_BIN_TARGETS png-fix-itxt)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set
|
|
||||||
IF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
|
||||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib")
|
|
||||||
ENDIF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
|
||||||
|
|
||||||
# Set a variable with CMake code which:
|
# Set a variable with CMake code which:
|
||||||
# Creates a symlink from src to dest (if possible) or alternatively
|
# Creates a symlink from src to dest (if possible) or alternatively
|
||||||
# copies if different.
|
# copies if different.
|
||||||
macro(CREATE_SYMLINK SRC_FILE DEST_FILE)
|
include(CMakeParseArguments)
|
||||||
FILE(REMOVE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
|
|
||||||
if(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
|
function(CREATE_SYMLINK DEST_FILE)
|
||||||
ADD_CUSTOM_COMMAND(
|
|
||||||
OUTPUT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
|
cmake_parse_arguments(S "" "FILE;TARGET" "" ${ARGN})
|
||||||
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}
|
if(NOT S_TARGET AND NOT S_FILE)
|
||||||
DEPENDS ${PNG_LIB_TARGETS}
|
message(FATAL_ERROR "Specify either a TARGET or a FILE for CREATE_SYMLINK to link to.")
|
||||||
)
|
endif(NOT S_TARGET AND NOT S_FILE)
|
||||||
ADD_CUSTOM_TARGET(${DEST_FILE}_COPY ALL DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
|
|
||||||
else(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
|
if(S_TARGET AND S_FILE)
|
||||||
get_filename_component(LINK_TARGET "${SRC_FILE}" NAME)
|
message(FATAL_ERROR "CREATE_SYMLINK called with both source file ${S_FILE} and build target ${S_TARGET} arguments - can only handle 1 type per call.")
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
endif(S_TARGET AND S_FILE)
|
||||||
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})
|
if(S_FILE)
|
||||||
endif(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
|
# If we don't need to symlink something that's coming from a build target,
|
||||||
endmacro()
|
# we can go ahead and symlink/copy at configure time.
|
||||||
|
|
||||||
|
if(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${S_FILE} ${DEST_FILE}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
|
)
|
||||||
|
else(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E create_symlink ${S_FILE} ${DEST_FILE}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
|
)
|
||||||
|
endif(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||||
|
endif(S_FILE)
|
||||||
|
|
||||||
|
if(S_TARGET)
|
||||||
|
# We need to use generator expressions, which can be a bit tricky, so 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 AND NOT MSYS)
|
||||||
|
add_custom_command(TARGET ${S_TARGET} POST_BUILD
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE}
|
||||||
|
)
|
||||||
|
else(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||||
|
add_custom_command(TARGET ${S_TARGET} POST_BUILD
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E create_symlink $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE}
|
||||||
|
)
|
||||||
|
endif(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||||
|
|
||||||
|
endif(S_TARGET)
|
||||||
|
|
||||||
|
endfunction()
|
||||||
|
|
||||||
# Create source generation scripts.
|
# Create source generation scripts.
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in
|
||||||
@ -807,11 +834,11 @@ if(NOT WIN32 OR CYGWIN OR MINGW)
|
|||||||
set(LIBS "-lz -lm")
|
set(LIBS "-lz -lm")
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
|
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
|
||||||
CREATE_SYMLINK(${PNGLIB_NAME}.pc libpng.pc)
|
CREATE_SYMLINK(libpng.pc FILE ${PNGLIB_NAME}.pc)
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
|
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
|
||||||
CREATE_SYMLINK(${PNGLIB_NAME}-config libpng-config)
|
CREATE_SYMLINK(libpng-config FILE ${PNGLIB_NAME}-config)
|
||||||
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
|
|
||||||
# SET UP LINKS
|
# SET UP LINKS
|
||||||
@ -844,26 +871,20 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
|||||||
if(PNG_SHARED)
|
if(PNG_SHARED)
|
||||||
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
|
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
|
||||||
if(CYGWIN OR MINGW)
|
if(CYGWIN OR MINGW)
|
||||||
get_target_property(BUILD_TARGET_LOCATION png LOCATION_${CMAKE_BUILD_TYPE})
|
CREATE_SYMLINK(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png)
|
||||||
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
|
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
endif(CYGWIN OR MINGW)
|
endif(CYGWIN OR MINGW)
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
get_target_property(BUILD_TARGET_LOCATION png LOCATION_${CMAKE_BUILD_TYPE})
|
CREATE_SYMLINK(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png)
|
||||||
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
|
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
endif(NOT WIN32)
|
endif(NOT WIN32)
|
||||||
endif(PNG_SHARED)
|
endif(PNG_SHARED)
|
||||||
|
|
||||||
if(PNG_STATIC)
|
if(PNG_STATIC)
|
||||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
get_target_property(BUILD_TARGET_LOCATION png_static LOCATION_${CMAKE_BUILD_TYPE})
|
CREATE_SYMLINK( libpng${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static)
|
||||||
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
|
install(FILES $<TARGET_LINKER_FILE_DIR:png_static>/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user