Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 10817 → Rev 10818

/trunk/Scribus/cmake/modules/ScribusFindPackageHandleStandardArgs.cmake
0,0 → 1,66
#
# This file was copied from CMake 2.5. It's used to permit CMake 2.4
# to use the CMake 2.5-derived find scripts here.
#
IF (NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
# Use the original from cmake 2.5 if possible
INCLUDE(FindPackageHandleStandardArgs)
ELSE(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
# or define our own...
 
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... )
# This macro is intended to be used in FindXXX.cmake modules files.
# It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and
# it also sets the <UPPERCASED_NAME>_FOUND variable.
# The package is found if all variables listed are TRUE.
# Example:
#
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
#
# LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and
# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
# If it is not found and REQUIRED was used, it fails with FATAL_ERROR,
# independent whether QUIET was used or not.
# If it is found, the location is reported using the VAR1 argument, so
# here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out.
# If the second argument is DEFAULT_MSG, the message in the failure case will
# be "Could NOT find LibXml2", if you don't like this message you can specify
# your own custom failure message there.
 
MACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 )
 
IF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
SET(_FAIL_MESSAGE "Could NOT find ${_NAME}")
ELSE("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
SET(_FAIL_MESSAGE "${_FAIL_MSG}")
ENDIF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
 
STRING(TOUPPER ${_NAME} _NAME_UPPER)
 
SET(${_NAME_UPPER}_FOUND TRUE)
IF(NOT ${_VAR1})
SET(${_NAME_UPPER}_FOUND FALSE)
ENDIF(NOT ${_VAR1})
 
FOREACH(_CURRENT_VAR ${ARGN})
IF(NOT ${_CURRENT_VAR})
SET(${_NAME_UPPER}_FOUND FALSE)
ENDIF(NOT ${_CURRENT_VAR})
ENDFOREACH(_CURRENT_VAR)
 
IF (${_NAME_UPPER}_FOUND)
IF (NOT ${_NAME}_FIND_QUIETLY)
MESSAGE(STATUS "Found ${_NAME}: ${${_VAR1}}")
ENDIF (NOT ${_NAME}_FIND_QUIETLY)
ELSE (${_NAME_UPPER}_FOUND)
IF (${_NAME}_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE}")
ELSE (${_NAME}_FIND_REQUIRED)
IF (NOT ${_NAME}_FIND_QUIETLY)
MESSAGE(STATUS "${_FAIL_MESSAGE}")
ENDIF (NOT ${_NAME}_FIND_QUIETLY)
ENDIF (${_NAME}_FIND_REQUIRED)
ENDIF (${_NAME_UPPER}_FOUND)
ENDMACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
 
ENDIF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
/trunk/Scribus/cmake/modules/FindZLIB.cmake
0,0 → 1,55
# - Find zlib
# Find the native ZLIB includes and library
#
# ZLIB_INCLUDE_DIR - where to find zlib.h, etc.
# ZLIB_LIBRARIES - List of libraries when using zlib.
# ZLIB_FOUND - True if zlib found.
 
 
IF (ZLIB_INCLUDE_DIR)
# Already in cache, be silent
SET(ZLIB_FIND_QUIETLY TRUE)
ENDIF (ZLIB_INCLUDE_DIR)
 
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h)
 
# On win32, qt statically links to zlib and libpng, and exports their symbols.
# We can just link to Qt to get zlib and libpng. We still require the user to
# supply their own headers on the search path, but they can and should just
# specify ${QTDIR}/src/3rdparty/zlib/include .
# To use this, you must use FindQt before FindZlib.
IF(QT_QTCORE_LIBRARY AND USE_QT_ZLIB_PNGLIB)
 
MESSAGE("Using zlib from qt")
SET(ZLIB_LIBRARY_RELEASE ${QT_QTCORE_LIBRARY_RELEASE})
SET(ZLIB_LIBRARY_DEBUG ${QT_QTCORE_LIBRARY_DEBUG})
SET(ZLIB_LIBRARY ${QT_QTCORE_LIBRARY})
 
ELSE(QT_QTCORE_LIBRARY AND USE_QT_ZLIB_PNGLIB)
 
SET(ZLIB_NAMES_RELEASE ${ZLIB_NAMES_RELEASE} ${ZLIB_NAMES} z zlib zdll zlib1)
FIND_LIBRARY(ZLIB_LIBRARY_RELEASE NAMES ${ZLIB_NAMES_RELEASE} )
 
# Find a debug library if one exists and use that for debug builds.
# This really only does anything for win32, but does no harm on other
# platforms.
SET(ZLIB_NAMES_DEBUG ${ZLIB_NAMES_DEBUG} zlibd zlib1d)
FIND_LIBRARY(ZLIB_LIBRARY_DEBUG NAMES ${ZLIB_NAMES_DEBUG})
 
INCLUDE(LibraryDebugAndRelease)
SET_LIBRARY_FROM_DEBUG_AND_RELEASE(ZLIB)
 
ENDIF(QT_QTCORE_LIBRARY AND USE_QT_ZLIB_PNGLIB)
 
# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(ScribusFindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
 
IF(ZLIB_FOUND)
SET( ZLIB_LIBRARIES ${ZLIB_LIBRARY} )
ELSE(ZLIB_FOUND)
SET( ZLIB_LIBRARIES )
ENDIF(ZLIB_FOUND)
 
MARK_AS_ADVANCED( ZLIB_LIBRARY ZLIB_INCLUDE_DIR )
/trunk/Scribus/cmake/modules/FREETYPEConfig.cmake
37,18 → 37,27
)
ENDIF (BUILD_OSX_BUNDLE)
 
IF (BUILD_OSX_BUNDLE)
FIND_LIBRARY(FREETYPE_LIBRARY freetype ${FREETYPE_LIBRARY_NAMES}
PATHS /opt/local/lib
NO_CMAKE_SYSTEM_PATH
)
ELSE (BUILD_OSX_BUNDLE)
FIND_LIBRARY(FREETYPE_LIBRARY freetype ${FREETYPE_LIBRARY_NAMES}
PATHS /usr/lib /usr/local/lib
NO_CMAKE_SYSTEM_PATH
)
ENDIF (BUILD_OSX_BUNDLE)
SET(FREETYPE_LIBRARY_NAMES_DEBUG ${FREETYPE_LIBRARY_NAMES_DEBUG} freetyped)
SET(FREETYPE_LIBRARY_NAMES_RELEASE ${FREETYPE_LIBRARY_NAMES_RELEASE} freetype)
 
IF(BUILD_OSX_BUNDLE)
SET(FREETYPE_LIB_PATHS /opt/local/lib)
ELSE(BUILD_OSX_BUNDLE)
SET(FREETYPE_LIB_PATHS /usr/lib /usr/local/lib)
ENDIF(BUILD_OSX_BUNDLE)
 
FIND_LIBRARY(FREETYPE_LIBRARY_RELEASE ${FREETYPE_LIBRARY_NAMES_RELEASE} ${FREETYPE_LIBRARY_NAMES}
PATHS
${FREETYPE_LIB_PATHS}
NO_CMAKE_SYSTEM_PATH)
FIND_LIBRARY(FREETYPE_LIBRARY_DEBUG ${FREETYPE_LIBRARY_NAMES_DEBUG}
PATHS
${FREETYPE_LIB_PATHS}
NO_CMAKE_SYSTEM_PATH)
 
INCLUDE(LibraryDebugAndRelease)
SET_LIBRARY_FROM_DEBUG_AND_RELEASE(FREETYPE)
 
# MESSAGE(STATUS "ft lib ${FREETYPE_LIBRARY}")
# MESSAGE(STATUS "ft2 build ${FREETYPE_INCLUDE_DIR_FT2BUILD}")
# MESSAGE(STATUS "ft header ${FREETYPE_INCLUDE_DIR_FTHEADER}")
/trunk/Scribus/cmake/modules/FindPNG.cmake
0,0 → 1,75
# - Find the native PNG includes and library
#
# This module defines
# PNG_INCLUDE_DIR, where to find png.h, etc.
# PNG_LIBRARIES, the libraries to link against to use PNG.
# PNG_DEFINITIONS - You should ADD_DEFINITONS(${PNG_DEFINITIONS}) before compiling code that includes png library files.
# PNG_FOUND, If false, do not try to use PNG.
# also defined, but not for general use are
# PNG_LIBRARY, where to find the PNG library.
# None of the above will be defined unles zlib can be found.
# PNG depends on Zlib
INCLUDE(FindZLIB)
 
IF(ZLIB_FOUND)
 
FIND_PATH(PNG_PNG_INCLUDE_DIR png.h
/usr/local/include/libpng # OpenBSD
)
 
# On win32, qt statically links to zlib and libpng, and exports their symbols.
# We can just link to Qt to get zlib and libpng. We still require the user to
# supply their own headers on the search path, but they can and should just
# specify ${QTDIR}/src/3rdparty/zlib/include .
# To use this, you must use FindQt before FindPng.
IF(QT_QTCORE_LIBRARY AND USE_QT_ZLIB_PNGLIB)
 
MESSAGE("Using libpng from qt")
IF(NOT "${ZLIB_LIBRARY}" STREQUAL "${QT_QTCORE_LIBRARY}")
MESSAGE("WARNING: We may be using an external zlib but qt's libpng")
ENDIF(NOT "${ZLIB_LIBRARY}" STREQUAL "${QT_QTCORE_LIBRARY}")
SET(PNG_LIBRARY_RELEASE ${QT_QTCORE_LIBRARY_RELEASE})
SET(PNG_LIBRARY_DEBUG ${QT_QTCORE_LIBRARY_DEBUG})
SET(PNG_LIBRARY ${QT_QTCORE_LIBRARY})
 
ELSE(QT_QTCORE_LIBRARY AND USE_QT_ZLIB_PNGLIB)
 
SET(PNG_NAMES_RELEASE ${PNG_NAMES_RELEASE} ${PNG_NAMES} png libpng png13 libpng13)
FIND_LIBRARY(PNG_LIBRARY_RELEASE NAMES ${PNG_NAMES_RELEASE} )
 
SET(PNG_NAMES_DEBUG ${PNG_NAMES} pngd libpngd png13d libpng13d)
FIND_LIBRARY(PNG_LIBRARY_DEBUG NAMES ${PNG_NAMES_DEBUG} )
 
INCLUDE(LibraryDebugAndRelease)
SET_LIBRARY_FROM_DEBUG_AND_RELEASE(PNG)
 
ENDIF(QT_QTCORE_LIBRARY AND USE_QT_ZLIB_PNGLIB)
 
IF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
# png.h includes zlib.h. Sigh.
SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
IF(NOT USE_QT_ZLIB_PNGLIB)
# libpng requires zlib unless we're linking to both in the form of Qt
SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
ENDIF(NOT USE_QT_ZLIB_PNGLIB)
 
IF (CYGWIN)
IF(BUILD_SHARED_LIBS)
# No need to define PNG_USE_DLL here, because it's default for Cygwin.
ELSE(BUILD_SHARED_LIBS)
SET (PNG_DEFINITIONS -DPNG_STATIC)
ENDIF(BUILD_SHARED_LIBS)
ENDIF (CYGWIN)
 
ENDIF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
 
ENDIF(ZLIB_FOUND)
 
# handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(ScribusFindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PNG DEFAULT_MSG PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
 
MESSAGE("Using PNG Library: ${PNG_LIBRARY}")
 
MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )
/trunk/Scribus/cmake/modules/FindJPEG.cmake
0,0 → 1,35
# - Find JPEG
# Find the native JPEG includes and library
# This module defines
# JPEG_INCLUDE_DIR, where to find jpeglib.h, etc.
# JPEG_LIBRARIES, the libraries needed to use JPEG.
# JPEG_FOUND, If false, do not try to use JPEG.
# also defined, but not for general use are
# JPEG_LIBRARY, where to find the JPEG library.
 
FIND_PATH(JPEG_INCLUDE_DIR jpeglib.h)
 
SET(JPEG_NAMES_RELEASE ${JPEG_NAMES_RELEASE} ${JPEG_NAMES} jpeg libjpeg)
FIND_LIBRARY(JPEG_LIBRARY_RELEASE NAMES ${JPEG_NAMES_RELEASE} )
 
SET(JPEG_NAMES_DEBUG ${JPEG_NAMES_DEBUG} jpegd libjpegd jpeg_d libjpeg_d)
FIND_LIBRARY(JPEG_LIBRARY_DEBUG NAMES ${JPEG_NAMES_DEBUG} )
 
INCLUDE(LibraryDebugAndRelease)
SET_LIBRARY_FROM_DEBUG_AND_RELEASE(JPEG)
 
 
# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(ScribusFindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARY JPEG_INCLUDE_DIR)
 
IF(JPEG_FOUND)
SET(JPEG_LIBRARIES ${JPEG_LIBRARY})
ENDIF(JPEG_FOUND)
 
# Deprecated declarations.
SET (NATIVE_JPEG_INCLUDE_PATH ${JPEG_INCLUDE_DIR} )
GET_FILENAME_COMPONENT (NATIVE_JPEG_LIB_PATH ${JPEG_LIBRARY} PATH)
 
MARK_AS_ADVANCED(JPEG_LIBRARY JPEG_INCLUDE_DIR )
/trunk/Scribus/cmake/modules/FindTIFF.cmake
0,0 → 1,28
# - Find TIFF library
# Find the native TIFF includes and library
# This module defines
# TIFF_INCLUDE_DIR, where to find tiff.h, etc.
# TIFF_LIBRARIES, libraries to link against to use TIFF.
# TIFF_FOUND, If false, do not try to use TIFF.
# also defined, but not for general use are
# TIFF_LIBRARY, where to find the TIFF library.
 
FIND_PATH(TIFF_INCLUDE_DIR tiff.h)
 
SET(TIFF_NAMES_RELEASE ${TIFF_NAMES_RELEASE} ${TIFF_NAMES} tiff libtiff)
SET(TIFF_NAMES_DEBUG ${TIFF_NAMES_DEBUG} tiffd libtiffd)
 
FIND_LIBRARY(TIFF_LIBRARY_RELEASE NAMES ${TIFF_NAMES_RELEASE} )
FIND_LIBRARY(TIFF_LIBRARY_DEBUG NAMES ${TIFF_NAMES_DEBUG} )
 
INCLUDE(LibraryDebugAndRelease)
SET_LIBRARY_FROM_DEBUG_AND_RELEASE(TIFF)
 
# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(ScribusFindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF DEFAULT_MSG TIFF_LIBRARY TIFF_INCLUDE_DIR)
 
IF(TIFF_FOUND)
SET( TIFF_LIBRARIES ${TIFF_LIBRARY} )
ENDIF(TIFF_FOUND)
/trunk/Scribus/cmake/modules/LibraryDebugAndRelease.cmake
0,0 → 1,25
#
# This macro is used when we may have a debug and or release build of a library,
# and we want to produce a single easy to use library string that'll do the right
# thing. If both debug and release versions are available, we'll automatically use the
# debug version for debug builds and the release version for release builds.
#
# If only one build exists, we use that one irrespective of build type.
#
MACRO(SET_LIBRARY_FROM_DEBUG_AND_RELEASE _NAME)
 
IF(NOT DEFINED "${_NAME}_LIBRARY_RELEASE" OR NOT DEFINED "${_NAME}_LIBRARY_DEBUG")
MESSAGE(FATAL_ERROR "${_NAME}_LIBRARY_DEBUG OR ${_NAME}_LIBRARY_RELEASE undefined")
ENDIF(NOT DEFINED "${_NAME}_LIBRARY_RELEASE" OR NOT DEFINED "${_NAME}_LIBRARY_DEBUG")
IF(${_NAME}_LIBRARY_RELEASE AND ${_NAME}_LIBRARY_DEBUG)
SET(${_NAME}_LIBRARY "optimized;${${_NAME}_LIBRARY_RELEASE};debug;${${_NAME}_LIBRARY_DEBUG}")
ELSE(${_NAME}_LIBRARY_RELEASE AND ${_NAME}_LIBRARY_DEBUG)
IF(${_NAME}_LIBRARY_DEBUG)
MESSAGE("WARNING: ${_NAME} debug library will be used even for release builds")
SET(${_NAME}_LIBRARY ${${_NAME}_LIBRARY_DEBUG})
ELSE(${_NAME}_LIBRARY_DEBUG)
SET(${_NAME}_LIBRARY ${${_NAME}_LIBRARY_RELEASE})
ENDIF(${_NAME}_LIBRARY_DEBUG)
ENDIF(${_NAME}_LIBRARY_RELEASE AND ${_NAME}_LIBRARY_DEBUG)
 
ENDMACRO(SET_LIBRARY_FROM_DEBUG_AND_RELEASE)
/trunk/Scribus/cmake/modules/FindLCMS.cmake
23,11 → 23,23
/usr/local/include
)
 
FIND_LIBRARY(LCMS_LIBRARY
NAMES lcms liblcms lcmsdll
FIND_LIBRARY(LCMS_LIBRARY_RELEASE
NAMES ${LCMS_NAMES_RELEASE} ${LCMS_NAMES} lcms liblcms lcmsdll
PATHS /usr/lib /usr/local/lib
)
 
FIND_LIBRARY(LCMS_LIBRARY_DEBUG
NAMES ${LCMS_NAMES_DEBUG} lcmsd liblcmsd lcmsdlld
PATHS /usr/lib /usr/local/lib
)
 
INCLUDE(LibraryDebugAndRelease)
SET_LIBRARY_FROM_DEBUG_AND_RELEASE(LCMS)
 
MESSAGE("LCMS ReleaseLibrary: ${LCMS_LIBRARY_RELEASE}")
MESSAGE("LCMS Debug Library: ${LCMS_LIBRARY_DEBUG}")
MESSAGE("LCMS Library: ${LCMS_LIBRARY}")
 
IF (LCMS_LIBRARY AND LCMS_INCLUDE_DIR)
SET( LCMS_FOUND 1 )
SET( LCMS_LIBRARIES ${LCMS_LIBRARY} )