[devel] Revised CMakeLists.txt (Clifford Yapp)
This commit is contained in:
parent
d4e1ddb631
commit
b17c75b222
5
ANNOUNCE
5
ANNOUNCE
@ -1,5 +1,5 @@
|
||||
|
||||
Libpng 1.5.5beta04 - July 27, 2011
|
||||
Libpng 1.5.5beta04 - July 28, 2011
|
||||
|
||||
This is not intended to be a public release. It will be replaced
|
||||
within a few weeks by a public version or by another test version.
|
||||
@ -40,7 +40,8 @@ Version 1.5.5beta03 [July 27, 2011]
|
||||
changes to pngrutil.c to cast results where C++ expects it but C does not.
|
||||
Minor editing of libpng.3 and libpng-manual.txt.
|
||||
|
||||
Version 1.5.5beta04 [July 27, 2011]
|
||||
Version 1.5.5beta04 [July 28, 2011]
|
||||
Revised CMakeLists.txt (Clifford Yapp)
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
|
||||
(subscription required; visit
|
||||
|
3
CHANGES
3
CHANGES
@ -3524,7 +3524,8 @@ Version 1.5.5beta03 [July 27, 2011]
|
||||
changes to pngrutil.c to cast results where C++ expects it but C does not.
|
||||
Minor editing of libpng.3 and libpng-manual.txt.
|
||||
|
||||
Version 1.5.5beta04 [July 27, 2011]
|
||||
Version 1.5.5beta04 [July 28, 2011]
|
||||
Revised CMakeLists.txt (Clifford Yapp)
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
@ -217,22 +217,23 @@ endif()
|
||||
# Set a variable with CMake code which:
|
||||
# Creates a symlink from src to dest (if possible) or alternatively
|
||||
# copies if different.
|
||||
macro(_png_generate_symlink_code CODE SRC DEST)
|
||||
macro(CREATE_SYMLINK SRC_FILE DEST_FILE)
|
||||
FILE(REMOVE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
set(_png_gsc_message "Copying ${SRC} to ${DEST} if needed")
|
||||
set(_png_gsc_operation "copy_if_different")
|
||||
else()
|
||||
set(_png_gsc_message "Symlinking ${SRC} to ${DEST}")
|
||||
set(_png_gsc_operation "create_symlink")
|
||||
endif()
|
||||
|
||||
set(${CODE} "
|
||||
message(STATUS \"${_png_gsc_message}\")
|
||||
execute_process(COMMAND \${CMAKE_COMMAND} -E ${_png_gsc_operation}
|
||||
\"${SRC}\" \"${DEST}\")
|
||||
")
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
|
||||
DEPENDS ${PNG_LIB_NAME} ${PNG_LIB_NAME_STATIC}
|
||||
)
|
||||
ADD_CUSTOM_TARGET(${DEST_FILE}_COPY ALL DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
|
||||
else(WIN32 AND NOT CYGWIN)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${SRC_FILE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${SRC_FILE} ${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif(WIN32 AND NOT CYGWIN)
|
||||
endmacro()
|
||||
|
||||
|
||||
# CREATE PKGCONFIG FILES
|
||||
# we use the same files like ./configure, so we have to set its vars
|
||||
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
@ -245,17 +246,11 @@ 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)
|
||||
_png_generate_symlink_code(PNG_PC_INSTALL_CODE
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libpng.pc)
|
||||
install(CODE ${PNG_PC_INSTALL_CODE})
|
||||
CREATE_SYMLINK(${PNGLIB_NAME}.pc libpng.pc)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
|
||||
_png_generate_symlink_code(PNG_CONFIG_INSTALL_CODE
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libpng-config)
|
||||
install(CODE ${PNG_CONFIG_INSTALL_CODE})
|
||||
CREATE_SYMLINK(${PNGLIB_NAME}-config libpng-config)
|
||||
|
||||
# SET UP LINKS
|
||||
if(PNG_SHARED)
|
||||
@ -296,35 +291,21 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
||||
|
||||
# Create a symlink for libpng.dll.a => libpng15.dll.a on Cygwin
|
||||
if(CYGWIN)
|
||||
_png_generate_symlink_code(PNG_SHARED_IMPLIB_INSTALL_CODE
|
||||
${PNGLIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
||||
libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
|
||||
install(CODE ${PNG_SHARED_IMPLIB_INSTALL_CODE})
|
||||
install(FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
||||
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
|
||||
get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
|
||||
CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
endif(CYGWIN)
|
||||
|
||||
if(NOT WIN32)
|
||||
IF(CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||
_png_generate_symlink_code(PNG_SHARED_INSTALL_CODE
|
||||
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${PNGLIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
install(CODE ${PNG_SHARED_INSTALL_CODE})
|
||||
install(FILES
|
||||
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
|
||||
get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
|
||||
CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
ELSE(CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||
_png_generate_symlink_code(PNG_SHARED_INSTALL_CODE
|
||||
${PNGLIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
install(CODE ${PNG_SHARED_INSTALL_CODE})
|
||||
install(FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
ENDIF(CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||
endif()
|
||||
endif()
|
||||
endif(NOT WIN32)
|
||||
endif(PNG_SHARED)
|
||||
|
||||
if(PNG_STATIC)
|
||||
install(TARGETS ${PNG_LIB_NAME_STATIC}
|
||||
@ -332,24 +313,12 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
if(NOT WIN32 OR CYGWIN)
|
||||
IF(CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
|
||||
_png_generate_symlink_code(PNG_STATIC_INSTALL_CODE
|
||||
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${PNGLIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
install(CODE ${PNG_STATIC_INSTALL_CODE})
|
||||
install(FILES
|
||||
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME_STATIC} LOCATION_${CMAKE_BUILD_TYPE})
|
||||
get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
|
||||
CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
ELSE(CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
|
||||
_png_generate_symlink_code(PNG_STATIC_INSTALL_CODE
|
||||
${PNGLIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
install(CODE ${PNG_STATIC_INSTALL_CODE})
|
||||
install(FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
ENDIF(CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
|
||||
endif()
|
||||
endif(NOT WIN32 OR CYGWIN)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user