[legacy] Updated CMakeLists.txt for consistent indentation and to avoid an

unclosed if-statement warning (Philip Lowman).
This commit is contained in:
Glenn Randers-Pehrson 2010-01-04 10:06:38 -06:00
parent dc393e4162
commit 0f6cf8332f
3 changed files with 125 additions and 107 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.2.43beta01 - January 3, 2010 Libpng 1.2.43beta01 - January 4, 2010
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.
@ -42,7 +42,9 @@ Other information:
Changes since the last public release (1.2.42): Changes since the last public release (1.2.42):
version 1.2.43beta01 [January 3, 2010] version 1.2.43beta01 [January 4, 2010]
Updated CMakeLists.txt for consistent indentation and to avoid an
unclosed if-statement warning (Philip Lowman).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net

View File

@ -2641,8 +2641,11 @@ version 1.2.42rc05 [January 2, 2010]
in pngtest.c in pngtest.c
version 1.2.42 and 1.0.52 [January 3, 2010] version 1.2.42 and 1.0.52 [January 3, 2010]
No changes.
version 1.2.43beta01 [January 3, 2010] version 1.2.43beta01 [January 4, 2010]
Updated CMakeLists.txt for consistent indentation and to avoid an
unclosed if-statement warning (Philip Lowman).
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

@ -1,14 +1,20 @@
cmake_minimum_required(VERSION 2.4.3) cmake_minimum_required(VERSION 2.4.3)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE) if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug "Choose the type of build, options are:
Release RelWithDebInfo MinSizeRel.") None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
Debug
Release
RelWithDebInfo
MinSizeRel.")
endif() endif()
project(PNG C) project(libpng C)
enable_testing() enable_testing()
# Copyright (C) 2007 Glenn Randers-Pehrson # Copyright (C) 2007-2010 Glenn Randers-Pehrson
# This code is released under the libpng license. # This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer # For conditions of distribution and use, see the disclaimer
@ -20,24 +26,22 @@ set(PNGLIB_RELEASE 43)
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
# needed packages # needed packages
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
include_directories(${ZLIB_INCLUDE_DIR}) include_directories(${ZLIB_INCLUDE_DIR})
if(NOT WIN32) if(NOT WIN32)
find_library(M_LIBRARY find_library(M_LIBRARY
NAMES m NAMES m
PATHS /usr/lib /usr/local/lib PATHS /usr/lib /usr/local/lib
) )
if(NOT M_LIBRARY) if(NOT M_LIBRARY)
message(STATUS message(STATUS
"math library 'libm' not found - floating point support disabled") "math library 'libm' not found - floating point support disabled")
endif() endif()
else() else()
# not needed on windows # not needed on windows
set(M_LIBRARY "") set(M_LIBRARY "")
endif() endif()
# COMMAND LINE OPTIONS # COMMAND LINE OPTIONS
@ -54,9 +58,9 @@ endif()
if(MINGW) if(MINGW)
option(PNG_TESTS "Build pngtest" NO) option(PNG_TESTS "Build pngtest" NO)
else(MINGW) else()
option(PNG_TESTS "Build pngtest" YES) option(PNG_TESTS "Build pngtest" YES)
endif(MINGW) endif()
option(PNG_NO_CONSOLE_IO "FIXME" YES) option(PNG_NO_CONSOLE_IO "FIXME" YES)
option(PNG_NO_STDIO "FIXME" YES) option(PNG_NO_STDIO "FIXME" YES)
@ -68,21 +72,22 @@ option(PNGARG "FIXME" YES)
# maybe needs improving, but currently I don't know when we can enable what :) # maybe needs improving, but currently I don't know when we can enable what :)
set(png_asm_tmp "OFF") set(png_asm_tmp "OFF")
if(NOT WIN32) if(NOT WIN32)
find_program(uname_executable NAMES uname PATHS /bin /usr/bin /usr/local/bin) find_program(uname_executable NAMES uname PATHS /bin /usr/bin /usr/local/bin)
if(uname_executable) if(uname_executable)
EXEC_PROGRAM(${uname_executable} ARGS --machine OUTPUT_VARIABLE uname_output) exec_program(${uname_executable}
if("uname_output" MATCHES "^.*i[1-9]86.*$") ARGS --machine OUTPUT_VARIABLE uname_output)
if("uname_output" MATCHES "^.*i[1-9]86.*$")
set(png_asm_tmp "ON") set(png_asm_tmp "ON")
else("uname_output" MATCHES "^.*i[1-9]86.*$") else("uname_output" MATCHES "^.*i[1-9]86.*$")
set(png_asm_tmp "OFF") set(png_asm_tmp "OFF")
endif("uname_output" MATCHES "^.*i[1-9]86.*$") endif("uname_output" MATCHES "^.*i[1-9]86.*$")
endif(uname_executable) endif(uname_executable)
else() else()
# this env var is normally only set on win64 # this env var is normally only set on win64
SET(TEXT "ProgramFiles(x86)") set(TEXT "ProgramFiles(x86)")
if("$ENV{${TEXT}}" STREQUAL "") if("$ENV{${TEXT}}" STREQUAL "")
set(png_asm_tmp "ON") set(png_asm_tmp "ON")
endif("$ENV{${TEXT}}" STREQUAL "") endif("$ENV{${TEXT}}" STREQUAL "")
endif() endif()
# SET LIBNAME # SET LIBNAME
@ -94,26 +99,26 @@ set(CMAKE_DEBUG_POSTFIX "d")
# OUR SOURCES # OUR SOURCES
set(libpng_sources set(libpng_sources
png.h png.h
pngconf.h pngconf.h
png.c png.c
pngerror.c pngerror.c
pngget.c pngget.c
pngmem.c pngmem.c
pngpread.c pngpread.c
pngread.c pngread.c
pngrio.c pngrio.c
pngrtran.c pngrtran.c
pngrutil.c pngrutil.c
pngset.c pngset.c
pngtrans.c pngtrans.c
pngwio.c pngwio.c
pngwrite.c pngwrite.c
pngwtran.c pngwtran.c
pngwutil.c pngwutil.c
) )
set(pngtest_sources set(pngtest_sources
pngtest.c pngtest.c
) )
# SOME NEEDED DEFINITIONS # SOME NEEDED DEFINITIONS
@ -124,65 +129,66 @@ if(MSVC)
endif(MSVC) endif(MSVC)
if(PNG_SHARED OR NOT MSVC) if(PNG_SHARED OR NOT MSVC)
#if building msvc static this has NOT to be defined #if building msvc static this has NOT to be defined
add_definitions(-DZLIB_DLL) add_definitions(-DZLIB_DLL)
endif() endif()
add_definitions(-DLIBPNG_NO_MMX) add_definitions(-DLIBPNG_NO_MMX)
add_definitions(-DPNG_NO_MMX_CODE) add_definitions(-DPNG_NO_MMX_CODE)
if(PNG_CONSOLE_IO_SUPPORTED) if(PNG_CONSOLE_IO_SUPPORTED)
add_definitions(-DPNG_CONSOLE_IO_SUPPORTED) add_definitions(-DPNG_CONSOLE_IO_SUPPORTED)
endif() endif()
if(PNG_NO_CONSOLE_IO) if(PNG_NO_CONSOLE_IO)
add_definitions(-DPNG_NO_CONSOLE_IO) add_definitions(-DPNG_NO_CONSOLE_IO)
endif() endif()
if(PNG_NO_STDIO) if(PNG_NO_STDIO)
add_definitions(-DPNG_NO_STDIO) add_definitions(-DPNG_NO_STDIO)
endif() endif()
if(PNG_DEBUG) if(PNG_DEBUG)
add_definitions(-DPNG_DEBUG) add_definitions(-DPNG_DEBUG)
endif() endif()
if(NOT M_LIBRARY AND NOT WIN32) if(NOT M_LIBRARY AND NOT WIN32)
add_definitions(-DPNG_NO_FLOATING_POINT_SUPPORTED) add_definitions(-DPNG_NO_FLOATING_POINT_SUPPORTED)
endif() endif()
# NOW BUILD OUR TARGET # NOW BUILD OUR TARGET
include_directories(${PNG_SOURCE_DIR} ${ZLIB_INCLUDE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
if(PNG_SHARED) if(PNG_SHARED)
add_library(${PNG_LIB_NAME} SHARED ${libpng_sources}) add_library(${PNG_LIB_NAME} SHARED ${libpng_sources})
if(MSVC) if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name # msvc does not append 'lib' - do it here to have consistent name
set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib") set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib")
endif() endif()
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY}) target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
endif() endif()
if(PNG_STATIC) if(PNG_STATIC)
# does not work without changing name # does not work without changing name
set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static) set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static)
add_library(${PNG_LIB_NAME_STATIC} STATIC ${libpng_sources}) add_library(${PNG_LIB_NAME_STATIC} STATIC ${libpng_sources})
if(MSVC) if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name # msvc does not append 'lib' - do it here to have consistent name
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib") set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib")
endif() endif()
endif() endif()
if(PNG_SHARED AND WIN32) if(PNG_SHARED AND WIN32)
set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL) set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
endif() endif()
if(PNG_TESTS AND PNG_SHARED) if(PNG_TESTS AND PNG_SHARED)
# does not work with msvc due to png_lib_ver issue # does not work with msvc due to png_lib_ver issue
add_executable(pngtest ${pngtest_sources}) add_executable(pngtest ${pngtest_sources})
target_link_libraries(pngtest ${PNG_LIB_NAME}) target_link_libraries(pngtest ${PNG_LIB_NAME})
add_test(pngtest pngtest ${PNG_SOURCE_DIR}/pngtest.png) add_test(pngtest pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png)
endif() endif()
@ -193,62 +199,69 @@ set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_PREFIX}/lib) set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
set(includedir ${CMAKE_INSTALL_PREFIX}/include) set(includedir ${CMAKE_INSTALL_PREFIX}/include)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng.pc.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/libpng.pc.in
${PNG_BINARY_DIR}/libpng.pc) ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/libpng-config.in
${PNG_BINARY_DIR}/libpng-config) ${CMAKE_CURRENT_BINARY_DIR}/libpng-config)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng.pc.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/libpng.pc.in
${PNG_BINARY_DIR}/${PNGLIB_NAME}.pc) ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/libpng-config.in
${PNG_BINARY_DIR}/${PNGLIB_NAME}-config) ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config)
# SET UP LINKS # SET UP LINKS
if(PNG_SHARED) if(PNG_SHARED)
set_target_properties(${PNG_LIB_NAME} PROPERTIES set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 0.${PNGLIB_RELEASE}.1.2.43beta01 # VERSION 0.${PNGLIB_RELEASE}.1.2.43beta01
VERSION 0.${PNGLIB_RELEASE}.0 VERSION 0.${PNGLIB_RELEASE}.0
SOVERSION 0 SOVERSION 0
CLEAN_DIRECT_OUTPUT 1) CLEAN_DIRECT_OUTPUT 1)
endif() endif()
if(PNG_STATIC) if(PNG_STATIC)
if(NOT WIN32) if(NOT WIN32)
# that's uncool on win32 - it overwrites our static import lib... # that's uncool on win32 - it overwrites our static import lib...
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
OUTPUT_NAME ${PNG_LIB_NAME} OUTPUT_NAME ${PNG_LIB_NAME}
CLEAN_DIRECT_OUTPUT 1) CLEAN_DIRECT_OUTPUT 1)
endif() endif()
endif() endif()
# INSTALL # INSTALL
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
if(PNG_SHARED) if(PNG_SHARED)
install(TARGETS ${PNG_LIB_NAME} install(TARGETS ${PNG_LIB_NAME}
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib) ARCHIVE DESTINATION lib)
endif() endif()
if(PNG_STATIC) if(PNG_STATIC)
install(TARGETS ${PNG_LIB_NAME_STATIC} install(TARGETS ${PNG_LIB_NAME_STATIC}
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib) ARCHIVE DESTINATION lib)
endif() endif()
endif() endif()
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL ) if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
install(FILES png.h pngconf.h DESTINATION include) install(FILES png.h pngconf.h DESTINATION include)
install(FILES png.h pngconf.h DESTINATION include/${PNGLIB_NAME}) install(FILES png.h pngconf.h DESTINATION include/${PNGLIB_NAME})
endif() endif()
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL ) if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
install(PROGRAMS ${PNG_BINARY_DIR}/libpng-config DESTINATION bin) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
install(PROGRAMS ${PNG_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
DESTINATION bin)
endif() endif()
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
install(FILES libpng.3 libpngpf.3 DESTINATION man/man3) # Install man pages
install(FILES png.5 DESTINATION man/man5) install(FILES libpng.3 libpngpf.3 DESTINATION man/man3)
install(FILES ${PNG_BINARY_DIR}/libpng.pc DESTINATION lib/pkgconfig) install(FILES png.5 DESTINATION man/man5)
install(FILES ${PNG_BINARY_DIR}/libpng-config DESTINATION bin) # Install pkg-config files
install(FILES ${PNG_BINARY_DIR}/${PNGLIB_NAME}.pc DESTINATION lib/pkgconfig) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
install(FILES ${PNG_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin) DESTINATION lib/pkgconfig)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
DESTINATION bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
DESTINATION lib/pkgconfig)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
DESTINATION bin)
endif() endif()
# what's with libpng.txt and all the extra files? # what's with libpng.txt and all the extra files?