[devel] Revised CMakeLists.txt (Clifford Yapp)

This commit is contained in:
Glenn Randers-Pehrson 2011-07-27 20:47:13 -05:00
parent d4e1ddb631
commit b17c75b222
3 changed files with 43 additions and 72 deletions

View File

@ -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 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. 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. changes to pngrutil.c to cast results where C++ expects it but C does not.
Minor editing of libpng.3 and libpng-manual.txt. 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: Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit (subscription required; visit

View File

@ -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. changes to pngrutil.c to cast results where C++ expects it but C does not.
Minor editing of libpng.3 and libpng-manual.txt. 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 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -217,22 +217,23 @@ endif()
# 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(_png_generate_symlink_code CODE SRC DEST) macro(CREATE_SYMLINK SRC_FILE DEST_FILE)
if(WIN32 AND NOT CYGWIN) FILE(REMOVE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
set(_png_gsc_message "Copying ${SRC} to ${DEST} if needed") if(WIN32 AND NOT CYGWIN)
set(_png_gsc_operation "copy_if_different") ADD_CUSTOM_COMMAND(
else() OUTPUT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
set(_png_gsc_message "Symlinking ${SRC} to ${DEST}") COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE}
set(_png_gsc_operation "create_symlink") COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
endif() DEPENDS ${PNG_LIB_NAME} ${PNG_LIB_NAME_STATIC}
)
set(${CODE} " ADD_CUSTOM_TARGET(${DEST_FILE}_COPY ALL DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
message(STATUS \"${_png_gsc_message}\") else(WIN32 AND NOT CYGWIN)
execute_process(COMMAND \${CMAKE_COMMAND} -E ${_png_gsc_operation} execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${SRC_FILE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
\"${SRC}\" \"${DEST}\") execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${SRC_FILE} ${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
") endif(WIN32 AND NOT CYGWIN)
endmacro() endmacro()
# CREATE PKGCONFIG FILES # CREATE PKGCONFIG FILES
# we use the same files like ./configure, so we have to set its vars # we use the same files like ./configure, so we have to set its vars
if(NOT DEFINED CMAKE_INSTALL_LIBDIR) if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
@ -245,17 +246,11 @@ set(includedir ${CMAKE_INSTALL_PREFIX}/include)
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)
_png_generate_symlink_code(PNG_PC_INSTALL_CODE CREATE_SYMLINK(${PNGLIB_NAME}.pc libpng.pc)
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
${CMAKE_CURRENT_BINARY_DIR}/libpng.pc)
install(CODE ${PNG_PC_INSTALL_CODE})
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)
_png_generate_symlink_code(PNG_CONFIG_INSTALL_CODE CREATE_SYMLINK(${PNGLIB_NAME}-config libpng-config)
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
${CMAKE_CURRENT_BINARY_DIR}/libpng-config)
install(CODE ${PNG_CONFIG_INSTALL_CODE})
# SET UP LINKS # SET UP LINKS
if(PNG_SHARED) if(PNG_SHARED)
@ -295,36 +290,22 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
# Create a symlink for libpng.dll.a => libpng15.dll.a on Cygwin # Create a symlink for libpng.dll.a => libpng15.dll.a on Cygwin
if(CYGWIN) if(CYGWIN)
_png_generate_symlink_code(PNG_SHARED_IMPLIB_INSTALL_CODE get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
${PNGLIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX} get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}) CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
install(CODE ${PNG_SHARED_IMPLIB_INSTALL_CODE}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
install(FILES DESTINATION ${CMAKE_INSTALL_LIBDIR})
${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} endif(CYGWIN)
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT WIN32) if(NOT WIN32)
IF(CMAKE_LIBRARY_OUTPUT_DIRECTORY) get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
_png_generate_symlink_code(PNG_SHARED_INSTALL_CODE get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${PNGLIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
install(CODE ${PNG_SHARED_INSTALL_CODE}) DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES endif(NOT WIN32)
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} endif(PNG_SHARED)
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()
if(PNG_STATIC) if(PNG_STATIC)
install(TARGETS ${PNG_LIB_NAME_STATIC} install(TARGETS ${PNG_LIB_NAME_STATIC}
@ -332,25 +313,13 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(NOT WIN32 OR CYGWIN) if(NOT WIN32 OR CYGWIN)
IF(CMAKE_ARCHIVE_OUTPUT_DIRECTORY) get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME_STATIC} LOCATION_${CMAKE_BUILD_TYPE})
_png_generate_symlink_code(PNG_STATIC_INSTALL_CODE get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${PNGLIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX} CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
install(CODE ${PNG_STATIC_INSTALL_CODE}) DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES endif(NOT WIN32 OR CYGWIN)
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} endif()
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()
endif() endif()
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL ) if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )