diff options
Diffstat (limited to 'modules')
46 files changed, 1067 insertions, 880 deletions
diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 675659c4..70df69b2 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -1,4 +1,4 @@ -# install the cmake files +## install the cmake files file(GLOB cmakeFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.cmake") diff --git a/modules/CheckCXXSourceCompiles.cmake b/modules/CheckCXXSourceCompiles.cmake new file mode 100644 index 00000000..ba7f185c --- /dev/null +++ b/modules/CheckCXXSourceCompiles.cmake @@ -0,0 +1,68 @@ +# - Check if the source code provided in the SOURCE argument compiles. +# CHECK_CXX_SOURCE_COMPILES(SOURCE VAR) +# - macro which checks if the source code compiles +# SOURCE - source code to try to compile +# VAR - variable to store whether the source code compiled +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link + +GET_FILENAME_COMPONENT(_CHECK_CXX_SOURCE_COMPILES_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) +INCLUDE(${_CHECK_CXX_SOURCE_COMPILES_DIR}/HandleImportedTargetsInCMakeRequiredLibraries.cmake) + + +MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) + IF("${VAR}" MATCHES "^${VAR}$") + SET(MACRO_CHECK_FUNCTION_DEFINITIONS + "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") + IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + HANDLE_IMPORTED_TARGETS_IN_CMAKE_REQUIRED_LIBRARIES(_CHECK_CXX_SOURCE_COMPILES_CMAKE_REQUIRED_LIBRARES) + + SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${_CHECK_CXX_SOURCE_COMPILES_CMAKE_REQUIRED_LIBRARES}") +# "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + ELSE(CMAKE_REQUIRED_LIBRARIES) + SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES) + ENDIF(CMAKE_REQUIRED_LIBRARIES) + IF(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + ELSE(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES) + ENDIF(CMAKE_REQUIRED_INCLUDES) + FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" + "${SOURCE}\n") + + MESSAGE(STATUS "Performing Test ${VAR}") + TRY_COMPILE(${VAR} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + "${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}" + "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}" + OUTPUT_VARIABLE OUTPUT) + IF(${VAR}) + SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}") + MESSAGE(STATUS "Performing Test ${VAR} - Success") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" + "${OUTPUT}\n" + "Source file was:\n${SOURCE}\n") + ELSE(${VAR}) + MESSAGE(STATUS "Performing Test ${VAR} - Failed") + SET(${VAR} "" CACHE INTERNAL "Test ${VAR}") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" + "${OUTPUT}\n" + "Source file was:\n${SOURCE}\n") + ENDIF(${VAR}) + ENDIF("${VAR}" MATCHES "^${VAR}$") +ENDMACRO(CHECK_CXX_SOURCE_COMPILES) + diff --git a/modules/CheckCXXSourceRuns.cmake b/modules/CheckCXXSourceRuns.cmake new file mode 100644 index 00000000..c18d8b37 --- /dev/null +++ b/modules/CheckCXXSourceRuns.cmake @@ -0,0 +1,81 @@ +# - Check if the C++ source code provided in the SOURCE argument compiles and runs. +# CHECK_CXX_SOURCE_RUNS(SOURCE VAR) +# +# SOURCE - source code to try to compile +# VAR - variable to store the result, 1 for success, empty for failure +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link + +GET_FILENAME_COMPONENT(_CHECK_CXX_SOURCE_RUNS_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) +INCLUDE(${_CHECK_CXX_SOURCE_RUNS_DIR}/HandleImportedTargetsInCMakeRequiredLibraries.cmake) + +MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR) + IF("${VAR}" MATCHES "^${VAR}$") + SET(MACRO_CHECK_FUNCTION_DEFINITIONS + "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") + IF(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + HANDLE_IMPORTED_TARGETS_IN_CMAKE_REQUIRED_LIBRARIES(_CHECK_CXX_SOURCE_RUNS_CMAKE_REQUIRED_LIBRARES) + + SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${_CHECK_CXX_SOURCE_RUNS_CMAKE_REQUIRED_LIBRARES}") +# "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + ELSE(CMAKE_REQUIRED_LIBRARIES) + SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES) + ENDIF(CMAKE_REQUIRED_LIBRARIES) + IF(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + ELSE(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES) + ENDIF(CMAKE_REQUIRED_INCLUDES) + FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" + "${SOURCE}\n") + + MESSAGE(STATUS "Performing Test ${VAR}") + TRY_RUN(${VAR}_EXITCODE ${VAR}_COMPILED + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} + "${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}" + "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}" + COMPILE_OUTPUT_VARIABLE OUTPUT) + + # if it did not compile make the return value fail code of 1 + IF(NOT ${VAR}_COMPILED) + SET(${VAR}_EXITCODE 1) + ENDIF(NOT ${VAR}_COMPILED) + # if the return value was 0 then it worked + IF("${${VAR}_EXITCODE}" EQUAL 0) + SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}") + MESSAGE(STATUS "Performing Test ${VAR} - Success") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" + "${OUTPUT}\n" + "Return value: ${${VAR}}\n" + "Source file was:\n${SOURCE}\n") + ELSE("${${VAR}_EXITCODE}" EQUAL 0) + IF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") + SET(${VAR} "${${VAR}_EXITCODE}") + ELSE(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") + SET(${VAR} "" CACHE INTERNAL "Test ${VAR}") + ENDIF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") + + MESSAGE(STATUS "Performing Test ${VAR} - Failed") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" + "${OUTPUT}\n" + "Return value: ${${VAR}_EXITCODE}\n" + "Source file was:\n${SOURCE}\n") + ENDIF("${${VAR}_EXITCODE}" EQUAL 0) + ENDIF("${VAR}" MATCHES "^${VAR}$") +ENDMACRO(CHECK_CXX_SOURCE_RUNS) + diff --git a/modules/FindAGG.cmake b/modules/FindAGG.cmake index 94d68da4..86d5618a 100644 --- a/modules/FindAGG.cmake +++ b/modules/FindAGG.cmake @@ -21,7 +21,7 @@ else (AGG_INCLUDE_DIR AND AGG_LIBRARIES) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(PC_AGG libagg) + pkg_check_modules(PC_AGG QUIET libagg) set(AGG_DEFINITIONS ${PC_AGG_CFLAGS_OTHER}) endif (NOT WIN32) diff --git a/modules/FindBlitz.cmake b/modules/FindBlitz.cmake index 2427999e..a3abd6b0 100644 --- a/modules/FindBlitz.cmake +++ b/modules/FindBlitz.cmake @@ -23,7 +23,7 @@ if (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(PC_BLITZ qimageblitz) + pkg_check_modules(PC_BLITZ QUIET qimageblitz) endif (NOT WIN32) find_path(BLITZ_INCLUDES diff --git a/modules/FindBlueZ.cmake b/modules/FindBlueZ.cmake index 8601b935..8332797f 100644 --- a/modules/FindBlueZ.cmake +++ b/modules/FindBlueZ.cmake @@ -25,7 +25,7 @@ endif ( BLUEZ_INCLUDE_DIR AND BLUEZ_LIBRARIES ) if( NOT WIN32 ) find_package(PkgConfig) - pkg_check_modules(PC_BLUEZ bluez) + pkg_check_modules(PC_BLUEZ QUIET bluez) set(BLUEZ_DEFINITIONS ${PC_BLUEZ_CFLAGS_OTHER}) endif( NOT WIN32 ) diff --git a/modules/FindBoost.cmake b/modules/FindBoost.cmake index cf0333a0..8534abd9 100644 --- a/modules/FindBoost.cmake +++ b/modules/FindBoost.cmake @@ -1,575 +1,25 @@ # - Try to find Boost include dirs and libraries -# Usage of this module as follows: # -# SET(Boost_USE_STATIC_LIBS ON) -# SET(Boost_USE_MULTITHREAD OFF) -# FIND_PACKAGE( Boost COMPONENTS date_time filesystem iostreams ... ) -# -# The Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of -# boost version numbers that should be taken into account when searching -# for the libraries. Unfortunately boost puts the version number into the -# actual filename for the libraries, so this might be needed in the future -# when new boost versions are released. -# -# Currently this module searches for the following version numbers: -# 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, 1.36, 1.36.0, 1.36.1 -# -# The components list needs to be the actual names of boost libraries, that is -# the part of the actual library files that differ on different libraries. So -# its "date_time" for "libboost_date_time...". Anything else will result in -# errors -# -# Variables used by this module, they can change the default behaviour and need to be set -# before calling find_package: -# Boost_USE_STATIC_LIBS Can be set to ON to force the use of static -# boost libraries. Defaults to OFF -# Boost_USE_MULTITHREAD Can be set to OFF to use the non-multithreaded -# boost libraries. Defaults to ON. -# Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching -# the boost include directory. The default list -# of version numbers is: -# 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, -# 1.35, 1.35.0, 1.35.1, 1.36.0, 1.36.1 -# If you want to look for an older or newer -# version set this variable to a list of -# strings, where each string contains a number, i.e. -# SET(Boost_ADDITIONAL_VERSIONS "0.99.0" "1.35.0") -# Boost_MINIMUM_VERSION Can be used to require a specific minimum version of boost. -# Should be set as a plain string in the form "major.minor[.subminor]". -# If this variable is set and find_package is called with the REQUIRED -# option, FindBoost.cmake will fail if it doesn't find a suitable version. -# BOOST_ROOT Preferred installation prefix for searching for Boost, -# set this if the module has problems finding the proper Boost installation -# BOOST_INCLUDEDIR Set this to the include directory of Boost, if the -# module has problems finding the proper Boost installation -# BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the -# module has problems finding the proper Boost installation -# -# The last three variables are available also as environment variables -# -# -# Variables defined by this module: -# -# Boost_FOUND System has Boost, this means the include dir was found, -# as well as all the libraries specified in the COMPONENTS list -# Boost_INCLUDE_DIRS Boost include directories, not cached -# Boost_INCLUDE_DIR This is almost the same as above, but this one is cached and may be -# modified by advanced users -# Boost_LIBRARIES Link these to use the Boost libraries that you specified, not cached -# Boost_LIBRARY_DIRS The path to where the Boost library files are. -# Boost_VERSION The version number of the boost libraries that have been found, -# same as in version.hpp from Boost -# Boost_LIB_VERSION The version number in filename form as its appended to the library filenames -# Boost_MAJOR_VERSION major version number of boost -# Boost_MINOR_VERSION minor version number of boost -# Boost_SUBMINOR_VERSION subminor version number of boost -# Boost_LIB_DIAGNOSTIC_DEFINITIONS Only set on windows. Can be used with add_definitions -# to print diagnostic information about the automatic -# linking done on windows -# -# For each component you list the following variables are set. -# ATTENTION: The component names need to be in lower case, just as the boost -# library names however the cmake variables use upper case for the component -# part. So you'd get Boost_SERIALIZATION_FOUND for example. -# -# Boost_${COMPONENT}_FOUND True IF the Boost library "component" was found. -# Boost_${COMPONENT}_LIBRARY The absolute path of the Boost library "component". -# Boost_${COMPONENT}_LIBRARY_DEBUG The absolute path of the debug version of the -# Boost library "component". -# Boost_${COMPONENT}_LIBRARY_RELEASE The absolute path of the release version of the -# Boost library "component" +# Please see the Documentation for Boost in the CMake Manual for details +# This module only forwards to the one included in cmake for compatibility +# reasons. + +# This call is kept for compatibility of this module with CMake 2.6.2, which +# only knows about Boost < 1.37. +# Note: Do _not_ add new Boost versions here, we're trying to get rid +# of this module in kdelibs, but thats only possible if there's a CMake-included +# version that finds all modules that this file finds. +# Instead add a similar call with newer version numbers to the CMakeLists.txt +# in your project before calling find_package(Boost) # -# Copyright (c) 2006-2008 Andreas Schneider <mail@cynapses.org> -# Copyright (c) 2007 Wengo -# Copyright (c) 2007 Mike Jackson -# Copyright (c) 2008 Andreas Pakulat <apaku@gmx.de> +# Copyright (c) 2009 Andreas Pakulat <apaku@gmx.de> # # Redistribution AND use is allowed according to the terms of the New # BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# - -# MESSAGE(STATUS "Finding Boost libraries.... ") - -OPTION(Boost_USE_MULTITHREADED "Use the multithreaded versions of the boost libraries" ON) - -SET( _boost_TEST_VERSIONS ${Boost_ADDITIONAL_VERSIONS} "1.37" "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" "1.34" "1.33.1" "1.33.0" "1.33" ) - - -############################################ -# -# Check the existence of the libraries. -# -############################################ -# This macro was taken directly from the FindQt4.cmake file that is included -# with the CMake distribution. This is NOT my work. All work was done by the -# original authors of the FindQt4.cmake file. Only minor modifications were -# made to remove references to Qt and make this file more generally applicable -######################################################################### - -MACRO (_Boost_ADJUST_LIB_VARS basename) - IF (Boost_INCLUDE_DIR ) - #MESSAGE(STATUS "Adjusting ${basename} ") - - IF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE) - # if the generator supports configuration types then set - # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) - ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - # if there are no configuration types and CMAKE_BUILD_TYPE has no value - # then just use the release libraries - SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) - ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) - ENDIF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE) - - # if only the release version was found, set the debug variable also to the release version - IF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG) - SET(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE}) - SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE}) - SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE}) - ENDIF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG) - - # if only the debug version was found, set the release variable also to the debug version - IF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE) - SET(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG}) - SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG}) - SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG}) - ENDIF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE) - - IF (Boost_${basename}_LIBRARY) - SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library") - GET_FILENAME_COMPONENT(Boost_LIBRARY_DIRS "${Boost_${basename}_LIBRARY}" PATH) - SET(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory") - SET(Boost_${basename}_FOUND ON CACHE INTERNAL "Was the boost boost ${basename} library found") - ENDIF (Boost_${basename}_LIBRARY) - - ENDIF (Boost_INCLUDE_DIR ) - # Make variables changeble to the advanced user - MARK_AS_ADVANCED( - Boost_${basename}_LIBRARY - Boost_${basename}_LIBRARY_RELEASE - Boost_${basename}_LIBRARY_DEBUG - ) -ENDMACRO (_Boost_ADJUST_LIB_VARS) - -#------------------------------------------------------------------------------- - - -SET( _boost_IN_CACHE TRUE) -IF(Boost_INCLUDE_DIR) - FOREACH(COMPONENT ${Boost_FIND_COMPONENTS}) - STRING(TOUPPER ${COMPONENT} COMPONENT) - IF(NOT Boost_${COMPONENT}_FOUND) - SET( _boost_IN_CACHE FALSE) - ENDIF(NOT Boost_${COMPONENT}_FOUND) - ENDFOREACH(COMPONENT) -ELSE(Boost_INCLUDE_DIR) - SET( _boost_IN_CACHE FALSE) -ENDIF(Boost_INCLUDE_DIR) - -IF (_boost_IN_CACHE) - # in cache already - SET(Boost_FOUND TRUE) - FOREACH(COMPONENT ${Boost_FIND_COMPONENTS}) - STRING(TOUPPER ${COMPONENT} COMPONENT) - _Boost_ADJUST_LIB_VARS( ${COMPONENT} ) - SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${COMPONENT}_LIBRARY}) - ENDFOREACH(COMPONENT) - SET(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) - IF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0") - MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") - MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") - MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") - ENDIF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0") -ELSE (_boost_IN_CACHE) - # Need to search for boost - - IF(WIN32) - # In windows, automatic linking is performed, so you do not have to specify the libraries. - # If you are linking to a dynamic runtime, then you can choose to link to either a static or a - # dynamic Boost library, the default is to do a static link. You can alter this for a specific - # library "whatever" by defining BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to - # be linked dynamically. Alternatively you can force all Boost libraries to dynamic link by - # defining BOOST_ALL_DYN_LINK. - - # This feature can be disabled for Boost library "whatever" by defining BOOST_WHATEVER_NO_LIB, - # or for all of Boost by defining BOOST_ALL_NO_LIB. - - # If you want to observe which libraries are being linked against then defining - # BOOST_LIB_DIAGNOSTIC will cause the auto-linking code to emit a #pragma message each time - # a library is selected for linking. - SET(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define") - ENDIF(WIN32) - - - SET(_boost_INCLUDE_SEARCH_DIRS - C:/boost/include - "C:/Program Files/boost/boost_${Boost_MINIMUM_VERSION}" - # D: is very often the cdrom drive, IF you don't have a - # cdrom inserted it will popup a very annoying dialog - #D:/boost/include - /sw/local/include - ) - - SET(_boost_LIBRARIES_SEARCH_DIRS - C:/boost/lib - "C:/Program Files/boost/boost_${Boost_MINIMUM_VERSION}/lib" - /sw/local/lib - ) - - IF( NOT $ENV{BOOST_ROOT} STREQUAL "" ) - SET(_boost_INCLUDE_SEARCH_DIRS $ENV{BOOST_ROOT}/include ${_boost_INCLUDE_SEARCH_DIRS}) - SET(_boost_LIBRARIES_SEARCH_DIRS $ENV{BOOST_ROOT}/lib ${_boost_INCLUDE_SEARCH_DIRS}) - ENDIF( NOT $ENV{BOOST_ROOT} STREQUAL "" ) - - IF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) - SET(_boost_INCLUDE_SEARCH_DIRS $ENV{BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS}) - ENDIF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) - - IF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) - SET(_boost_LIBRARIES_SEARCH_DIRS $ENV{BOOST_LIBRARYDIR} ${_boost_INCLUDE_SEARCH_DIRS}) - ENDIF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) - - IF( BOOST_ROOT ) - IF( WIN32 ) - SET(_boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT} ${_boost_INCLUDE_SEARCH_DIRS}) - ELSE( WIN32 ) - SET(_boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT}/include ${_boost_INCLUDE_SEARCH_DIRS}) - ENDIF( WIN32 ) - SET(_boost_LIBRARIES_SEARCH_DIRS ${BOOST_ROOT}/lib ${_boost_LIBRARIES_SEARCH_DIRS}) - ENDIF( BOOST_ROOT ) - - IF( BOOST_INCLUDEDIR ) - SET(_boost_INCLUDE_SEARCH_DIRS ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS}) - ENDIF( BOOST_INCLUDEDIR ) - - IF( BOOST_LIBRARYDIR ) - SET(_boost_LIBRARIES_SEARCH_DIRS ${BOOST_LIBRARYDIR} ${_boost_LIBRARIES_SEARCH_DIRS}) - ENDIF( BOOST_LIBRARYDIR ) - - IF( Boost_MINIMUM_VERSION ) - IF(Boost_MINIMUM_VERSION MATCHES "[0-9]+\\.[0-9]+\\.[0-9]") - STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" Boost_FIND_VERSION_MAJOR ${Boost_MINIMUM_VERSION}) - STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" Boost_FIND_VERSION_MINOR ${Boost_MINIMUM_VERSION}) - STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\3" Boost_FIND_VERSION_PATCH ${Boost_MINIMUM_VERSION}) - ELSEIF(Boost_MINIMUM_VERSION MATCHES "[0-9]+\\.[0-9]+") - STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1" Boost_FIND_VERSION_MAJOR ${Boost_MINIMUM_VERSION}) - STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\2" Boost_FIND_VERSION_MINOR ${Boost_MINIMUM_VERSION}) - SET(Boost_FIND_VERSION_PATCH 0) - ELSE(Boost_MINIMUM_VERSION MATCHES "[0-9]+\\.[0-9]+\\.[0-9]") - MESSAGE(FATAL_ERROR "Wrong format for Boost_MINIMUM_VERSION variable, the format needs to be major.minor[.subminor]") - ENDIF(Boost_MINIMUM_VERSION MATCHES "[0-9]+\\.[0-9]+\\.[0-9]") - - ENDIF( Boost_MINIMUM_VERSION ) - - - # Try first in our own include search paths (e.g. BOOST_ROOT) - FOREACH(_boost_VER ${_boost_TEST_VERSIONS}) - IF( NOT Boost_INCLUDE_DIR ) - - # Add in a path suffix, based on the required version, ideally we could - # read this from version.hpp, but for that to work we'd need to know the include - # dir already - SET(_boost_PATH_SUFFIX - boost-${_boost_VER} - ) - - IF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") - STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" _boost_PATH_SUFFIX ${_boost_PATH_SUFFIX}) - ELSEIF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+") - STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" _boost_PATH_SUFFIX ${_boost_PATH_SUFFIX}) - ENDIF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") - - FIND_PATH(Boost_INCLUDE_DIR - NAMES boost/config.hpp - PATHS ${_boost_INCLUDE_SEARCH_DIRS} - PATH_SUFFIXES ${_boost_PATH_SUFFIX} - NO_DEFAULT_PATH - ) - - ENDIF( NOT Boost_INCLUDE_DIR ) - ENDFOREACH(_boost_VER) - - # If nothing is found search again using system default paths - FOREACH(_boost_VER ${_boost_TEST_VERSIONS}) - IF( NOT Boost_INCLUDE_DIR ) - - # Add in a path suffix, based on the required version, ideally we could - # read this from version.hpp, but for that to work we'd need to know the include - # dir already - SET(_boost_PATH_SUFFIX - boost-${_boost_VER} - ) - - IF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") - STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" _boost_PATH_SUFFIX ${_boost_PATH_SUFFIX}) - ELSEIF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+") - STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" _boost_PATH_SUFFIX ${_boost_PATH_SUFFIX}) - ENDIF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") - - FIND_PATH(Boost_INCLUDE_DIR - NAMES boost/config.hpp - PATH_SUFFIXES ${_boost_PATH_SUFFIX} - ) - - ENDIF(NOT Boost_INCLUDE_DIR) - ENDFOREACH(_boost_VER) - - IF(Boost_INCLUDE_DIR) - # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp - # Read the whole file: - # - SET(BOOST_VERSION 0) - SET(BOOST_LIB_VERSION "") - FILE(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS) - - STRING(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}") - STRING(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}") - - SET(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries") - SET(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries") - - IF(NOT "${Boost_VERSION}" STREQUAL "0") - MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") - MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") - MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") - ENDIF(NOT "${Boost_VERSION}" STREQUAL "0") - ENDIF(Boost_INCLUDE_DIR) - - #Setting some more suffixes for the library - SET (Boost_LIB_PREFIX "") - IF ( WIN32 AND Boost_USE_STATIC_LIBS ) - SET (Boost_LIB_PREFIX "lib") - ENDIF ( WIN32 AND Boost_USE_STATIC_LIBS ) - SET (_boost_COMPILER "-gcc") - IF (MSVC71) - SET (_boost_COMPILER "-vc71") - ENDIF(MSVC71) - IF (MSVC80) - SET (_boost_COMPILER "-vc80") - ENDIF(MSVC80) - IF (MSVC90) - SET (_boost_COMPILER "-vc90") - ENDIF(MSVC90) - IF (MINGW) - EXEC_PROGRAM(${CMAKE_CXX_COMPILER} - ARGS --version - OUTPUT_VARIABLE _boost_COMPILER_VERSION - ) - STRING(REGEX REPLACE ".* ([0-9])\\.([0-9])\\.[0-9].*" "\\1\\2" - _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION}) - SET (_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}") - ENDIF(MINGW) - IF (CYGWIN) - SET (_boost_COMPILER "-gcc") - ENDIF (CYGWIN) - IF (UNIX) - IF (APPLE) - SET (_boost_COMPILER "") - ELSE (APPLE) - IF (NOT CMAKE_COMPILER_IS_GNUCC) - # This is for the intel compiler - SET (_boost_COMPILER "-il") - ELSE (NOT CMAKE_COMPILER_IS_GNUCC) - #find out the version of gcc being used. - EXEC_PROGRAM(${CMAKE_CXX_COMPILER} - ARGS --version - OUTPUT_VARIABLE _boost_COMPILER_VERSION - ) - STRING(REGEX MATCH "([0-9])\\.([0-9])\\.[0-9]" - _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION}) - STRING(REGEX REPLACE "([0-9])\\.([0-9])\\.[0-9]" "\\1\\2" - _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION}) - SET (_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}") - ENDIF (NOT CMAKE_COMPILER_IS_GNUCC) - ENDIF (APPLE) - ENDIF(UNIX) - - SET (_boost_MULTITHREADED "-mt") - - IF( NOT Boost_USE_MULTITHREADED ) - SET (_boost_MULTITHREADED "") - ENDIF( NOT Boost_USE_MULTITHREADED ) - - SET( _boost_STATIC_TAG "") - IF (WIN32) - IF(MSVC) - SET (_boost_ABI_TAG "g") - ENDIF(MSVC) - IF( Boost_USE_STATIC_LIBS ) - SET( _boost_STATIC_TAG "-s") - ENDIF( Boost_USE_STATIC_LIBS ) - ENDIF(WIN32) - SET (_boost_ABI_TAG "${_boost_ABI_TAG}d") - - # ------------------------------------------------------------------------ - # Begin finding boost libraries - # ------------------------------------------------------------------------ - FOREACH(COMPONENT ${Boost_FIND_COMPONENTS}) - STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT) - SET( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" ) - SET( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" ) - SET( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND") - # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES - IF( Boost_USE_STATIC_LIBS ) - SET( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - IF(WIN32) - SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - ELSE(WIN32) - SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - ENDIF(WIN32) - ENDIF( Boost_USE_STATIC_LIBS ) - FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE - NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT} - PATHS ${_boost_LIBRARIES_SEARCH_DIRS} - NO_DEFAULT_PATH - ) - - IF( NOT ${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE} ) - FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE - NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT} - ) - ENDIF( NOT ${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE} ) - - FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG - NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_boost_ABI_TAG} - PATHS ${_boost_LIBRARIES_SEARCH_DIRS} - NO_DEFAULT_PATH - ) - - IF( NOT ${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG} ) - FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG - NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_boost_ABI_TAG} - ) - ENDIF( NOT ${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG} ) - IF( Boost_USE_STATIC_LIBS ) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) - ENDIF( Boost_USE_STATIC_LIBS ) - - _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT}) - ENDFOREACH(COMPONENT) - # ------------------------------------------------------------------------ - # End finding boost libraries - # ------------------------------------------------------------------------ - - SET(Boost_INCLUDE_DIRS - ${Boost_INCLUDE_DIR} - ) - - # MESSAGE(STATUS "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}") - # MESSAGE(STATUS "Boost_LIBRARIES: ${Boost_LIBRARIES}") - - SET(Boost_FOUND FALSE) - IF(Boost_INCLUDE_DIR) - SET( Boost_FOUND TRUE ) - IF( Boost_FIND_VERSION_MAJOR AND Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" ) - SET( Boost_FOUND FALSE ) - ELSEIF( Boost_FIND_VERSION_MAJOR AND Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) - IF( Boost_FIND_VERSION_MINOR AND Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" ) - SET( Boost_FOUND FALSE ) - ELSEIF( Boost_FIND_VERSION_MINOR AND Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) - IF( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" ) - SET( Boost_FOUND FALSE ) - ENDIF( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" ) - ENDIF( Boost_FIND_VERSION_MINOR AND Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" ) - ENDIF( Boost_FIND_VERSION_MAJOR AND Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" ) - set(_boost_CHECKED_COMPONENT FALSE) - FOREACH(COMPONENT ${Boost_FIND_COMPONENTS}) - STRING(TOUPPER ${COMPONENT} COMPONENT) - set(_boost_CHECKED_COMPONENT TRUE) - IF(NOT Boost_${COMPONENT}_FOUND) - SET( Boost_FOUND FALSE) - ENDIF(NOT Boost_${COMPONENT}_FOUND) - ENDFOREACH(COMPONENT) - IF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) - # Compatibility Code for backwards compatibility with CMake 2.4 - - # Look for the boost library path. - # Note that the user may not have installed any libraries - # so it is quite possible the Boost_LIBRARY_PATH may not exist. - SET(_boost_LIB_DIR ${Boost_INCLUDE_DIR}) - - IF("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") - GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) - ENDIF ("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") - - IF("${_boost_LIB_DIR}" MATCHES "/include$") - # Strip off the trailing "/include" in the path. - GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) - ENDIF("${_boost_LIB_DIR}" MATCHES "/include$") - - IF(EXISTS "${_boost_LIB_DIR}/lib") - SET (_boost_LIB_DIR ${_boost_LIB_DIR}/lib) - ELSE(EXISTS "${_boost_LIB_DIR}/lib") - IF(EXISTS "${_boost_LIB_DIR}/stage/lib") - SET(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib) - ELSE(EXISTS "${_boost_LIB_DIR}/stage/lib") - SET(_boost_LIB_DIR "") - ENDIF(EXISTS "${_boost_LIB_DIR}/stage/lib") - ENDIF(EXISTS "${_boost_LIB_DIR}/lib") - - IF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") - SET(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory") - ENDIF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") - - ENDIF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) - - ELSE(Boost_INCLUDE_DIR) - SET( Boost_FOUND FALSE) - ENDIF(Boost_INCLUDE_DIR) - - IF (Boost_FOUND) - IF (NOT Boost_FIND_QUIETLY) - MESSAGE(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") - MESSAGE(STATUS "Found the following Boost libraries:") - ENDIF (NOT Boost_FIND_QUIETLY) - FOREACH ( COMPONENT ${Boost_FIND_COMPONENTS} ) - STRING( TOUPPER ${COMPONENT} UPPERCOMPONENT ) - IF ( Boost_${UPPERCOMPONENT}_FOUND ) - IF (NOT Boost_FIND_QUIETLY) - MESSAGE (STATUS " ${COMPONENT}") - ENDIF (NOT Boost_FIND_QUIETLY) - SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY}) - ENDIF ( Boost_${UPPERCOMPONENT}_FOUND ) - ENDFOREACH(COMPONENT) - ELSE (Boost_FOUND) - IF (Boost_FIND_REQUIRED) - MESSAGE(STATUS "Boost Version required: ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH} Found: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") - MESSAGE(FATAL_ERROR "Couldn't find the Boost libraries and/or include directory, or the version found is too old. Please install the Boost libraries AND development packages. You can set BOOST_ROOT, BOOST_INCLUDEDIR and BOOST_LIBRARYDIR to help find Boost.") - ENDIF(Boost_FIND_REQUIRED) - ENDIF(Boost_FOUND) - # Under Windows, automatic linking is performed, so no need to specify the libraries. - IF (WIN32) - IF (NOT MINGW) - SET(Boost_LIBRARIES "") - ENDIF (NOT MINGW) - ENDIF(WIN32) +set( Boost_ADDITIONAL_VERSIONS ${Boost_ADDITIONAL_VERSIONS} "1.37" ) - # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view - MARK_AS_ADVANCED(Boost_INCLUDE_DIR - Boost_INCLUDE_DIRS - Boost_LIBRARY_DIRS - Boost_USE_MULTITHREADED - ) -ENDIF(_boost_IN_CACHE) +include(${CMAKE_ROOT}/Modules/FindBoost.cmake) diff --git a/modules/FindENCHANT.cmake b/modules/FindENCHANT.cmake index 0b30f326..9c13c488 100644 --- a/modules/FindENCHANT.cmake +++ b/modules/FindENCHANT.cmake @@ -22,7 +22,7 @@ else (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(PC_ENCHANT enchant) + pkg_check_modules(PC_ENCHANT QUIET enchant) set(ENCHANT_DEFINITIONS ${PC_ENCHANT_CFLAGS_OTHER}) endif (NOT WIN32) diff --git a/modules/FindEigen2.cmake b/modules/FindEigen2.cmake index 2579a6c9..5feddf3e 100644 --- a/modules/FindEigen2.cmake +++ b/modules/FindEigen2.cmake @@ -16,10 +16,10 @@ if (EIGEN2_INCLUDE_DIR) else (EIGEN2_INCLUDE_DIR) find_path(EIGEN2_INCLUDE_DIR NAMES Eigen/Core - PATHS + PATH_SUFFIXES eigen2 + HINTS ${INCLUDE_INSTALL_DIR} ${KDE4_INCLUDE_DIR} - PATH_SUFFIXES eigen2 ) include(FindPackageHandleStandardArgs) diff --git a/modules/FindFontconfig.cmake b/modules/FindFontconfig.cmake index 268a61ae..5e2f3ead 100644 --- a/modules/FindFontconfig.cmake +++ b/modules/FindFontconfig.cmake @@ -23,7 +23,7 @@ else (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(PC_FONTCONFIG fontconfig) + pkg_check_modules(PC_FONTCONFIG QUIET fontconfig) set(FONTCONFIG_DEFINITIONS ${PC_FONTCONFIG_CFLAGS_OTHER}) endif (NOT WIN32) diff --git a/modules/FindGStreamer.cmake b/modules/FindGStreamer.cmake index 8e98b892..43793711 100644 --- a/modules/FindGStreamer.cmake +++ b/modules/FindGStreamer.cmake @@ -24,7 +24,7 @@ IF (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls FIND_PACKAGE(PkgConfig) - PKG_CHECK_MODULES(PC_GSTREAMER gstreamer-0.10) + PKG_CHECK_MODULES(PC_GSTREAMER QUIET gstreamer-0.10) #MESSAGE(STATUS "DEBUG: GStreamer include directory = ${GSTREAMER_INCLUDE_DIRS}") #MESSAGE(STATUS "DEBUG: GStreamer link directory = ${GSTREAMER_LIBRARY_DIRS}") #MESSAGE(STATUS "DEBUG: GStreamer CFlags = ${GSTREAMER_CFLAGS_OTHER}") diff --git a/modules/FindIOKit.cmake b/modules/FindIOKit.cmake new file mode 100644 index 00000000..f3e3ecb2 --- /dev/null +++ b/modules/FindIOKit.cmake @@ -0,0 +1,23 @@ +# - Find IOKit on Mac +# +# IOKIT_LIBRARY - the library to use IOKit +# IOKIT_FOUND - true if IOKit has been found + +# Copyright (c) 2009, Harald Fernengel <harry@kdevelop.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +include(CMakeFindFrameworks) + +cmake_find_frameworks(IOKit) +cmake_find_frameworks(CoreFoundation) + +if (IOKit_FRAMEWORKS) + set(IOKIT_LIBRARY "-framework IOKit -framework CoreFoundation" CACHE FILEPATH "IOKit framework" FORCE) + set(IOKIT_FOUND 1) +endif (IOKit_FRAMEWORKS) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(IOKit DEFAULT_MSG IOKIT_LIBRARY) + diff --git a/modules/FindKDE4Internal.cmake b/modules/FindKDE4Internal.cmake index 94297f9d..b5a9bb5a 100644 --- a/modules/FindKDE4Internal.cmake +++ b/modules/FindKDE4Internal.cmake @@ -41,8 +41,7 @@ # KDE4_KNOTIFYCONFIG_LIBRARY- the knotifyconfig library # KDE4_KROSSCORE_LIBRARY - the krosscore library # KDE4_KTEXTEDITOR_LIBRARY - the ktexteditor library -# KDE4_KNEPOMUK_LIBRARY - the knepomuk library -# KDE4_KMETADATA_LIBRARY - the kmetadata library +# KDE4_NEPOMUK_LIBRARY - the nepomuk library # KDE4_PLASMA_LIBRARY - the plasma library # # KDE4_PLASMA_OPENGL_FOUND - TRUE if the OpenGL support of Plasma has been found, NOTFOUND otherwise @@ -72,8 +71,7 @@ # KDE4_KROSSCORE_LIBS - the kross core library and all depending libraries # KDE4_KROSSUI_LIBS - the kross ui library which includes core and all depending libraries # KDE4_KTEXTEDITOR_LIBS - the ktexteditor library and all depending libraries -# KDE4_KNEPOMUK_LIBS - the knepomuk library and all depending libraries -# KDE4_KMETADATA_LIBS - the kmetadata library and all depending libraries +# KDE4_NEPOMUK_LIBS - the nepomuk library and all depending libraries # KDE4_PLASMA_LIBS - the plasma library and all depending librairies # # This module defines a bunch of variables used as locations for install directories. @@ -204,11 +202,11 @@ # # A note on the possible values for CMAKE_BUILD_TYPE and how KDE handles # the flags for those buildtypes. FindKDE4Internal supports the values -# Debug, Release, RelWithDebInfo, Profile and Debugfull +# Debug, Release, RelWithDebInfo, Profile and Debugfull: # # Release # optimised for speed, qDebug/kDebug turned off, no debug symbols -# Release with debug info +# RelWithDebInfo (Release with debug info) # optimised for speed, debugging symbols on (-g) # Debug # optimised but debuggable, debugging on (-g) @@ -286,7 +284,7 @@ else(KDE4_FIND_REQUIRED OR KDE4Internal_FIND_REQUIRED) set(_REQ_STRING_KDE4_MESSAGE "STATUS") endif(KDE4_FIND_REQUIRED OR KDE4Internal_FIND_REQUIRED) -set(QT_MIN_VERSION "4.4.0") +set(QT_MIN_VERSION "4.5.0") #this line includes FindQt4.cmake, which searches the Qt library and headers find_package(Qt4 ${_REQ_STRING_KDE4}) @@ -298,13 +296,24 @@ if (NOT AUTOMOC4_VERSION) # the version macro was added for 0.9.84 set(AUTOMOC4_VERSION "0.9.83") endif (NOT AUTOMOC4_VERSION) -macro_ensure_version("0.9.87" "${AUTOMOC4_VERSION}" _automoc4_version_ok) +set(_automoc4_min_version "0.9.88") +macro_ensure_version("${_automoc4_min_version}" "${AUTOMOC4_VERSION}" _automoc4_version_ok) # for compatibility with KDE 4.0.x set(KDE4_AUTOMOC_EXECUTABLE "${AUTOMOC4_EXECUTABLE}" ) -# Perl is required for building KDE software -find_package(Perl ${_REQ_STRING_KDE4}) +# Perl is not required for building KDE software, but we had that here since 4.0 +find_package(Perl) +if(NOT PERL_FOUND) + message(STATUS "Perl not found") +endif(NOT PERL_FOUND) + + +# we check for Phonon not here, but further below, i.e. after KDELibsDependencies.cmake +# has been loaded, which helps in the case that phonon is installed to the same +# directory as kdelibs. +# find_package(Phonon ${_REQ_STRING_KDE4}) + # Check that we really found everything. # If KDE4 was searched with REQUIRED, we error out with FATAL_ERROR if something wasn't found @@ -312,13 +321,9 @@ find_package(Perl ${_REQ_STRING_KDE4}) # If KDE4 was searched without REQUIRED and something in the FIND_PACKAGE() calls above wasn't found, # then we get here and must check that everything has actually been found. If something is missing, # we must not fail with FATAL_ERROR, but only not set KDE4_FOUND. -if(NOT PERL_FOUND) - message(STATUS "KDE4 not found, because Perl not found") - return() -endif(NOT PERL_FOUND) if(NOT QT4_FOUND) - message(STATUS "KDE4 not found, because Qt4 not found") + message(STATUS "KDE4 not found, because Qt4 was not found") return() endif(NOT QT4_FOUND) @@ -328,7 +333,7 @@ if(NOT AUTOMOC4_FOUND OR NOT _automoc4_version_ok) return() else(NOT AUTOMOC4_FOUND) if(NOT _automoc4_version_ok) - message(${_REQ_STRING_KDE4_MESSAGE} "Your version of automoc4 is too old. You have ${AUTOMOC4_VERSION}, you need at least 0.9.87") + message(${_REQ_STRING_KDE4_MESSAGE} "Your version of automoc4 is too old. You have ${AUTOMOC4_VERSION}, you need at least ${_automoc4_min_version}") return() endif(NOT _automoc4_version_ok) endif(NOT AUTOMOC4_FOUND) @@ -371,6 +376,7 @@ if (_kdeBootStrapping) set(KDE4_SOLID_LIBS ${KDE4_KDECORE_LIBS} solid) set(KDE4_KFILE_LIBS ${KDE4_KIO_LIBS} kfile) set(KDE4_KHTML_LIBS ${KDE4_KPARTS_LIBS} khtml) + set(KDE4_KTEXTEDITOR_LIBS ktexteditor) set(EXECUTABLE_OUTPUT_PATH ${kdelibs_BINARY_DIR}/bin ) @@ -482,13 +488,9 @@ else (_kdeBootStrapping) endif (UNIX) # these targets do not always exist, since they are built conditionally: - if(TARGET ${KDE4_TARGET_PREFIX}knepomuk) - _kde4_set_lib_variables(KNEPOMUK knepomuk ${KDE4_TARGET_PREFIX}) - endif(TARGET ${KDE4_TARGET_PREFIX}knepomuk) - - if(TARGET ${KDE4_TARGET_PREFIX}kmetadata) - _kde4_set_lib_variables(KMETADATA kmetadata ${KDE4_TARGET_PREFIX}) - endif(TARGET ${KDE4_TARGET_PREFIX}kmetadata) + if(TARGET ${KDE4_TARGET_PREFIX}nepomuk) + _kde4_set_lib_variables(NEPOMUK nepomuk ${KDE4_TARGET_PREFIX}) + endif(TARGET ${KDE4_TARGET_PREFIX}nepomuk) # and this one for compatibility: set(KDE4_THREADWEAVER_LIBRARIES ${KDE4_TARGET_PREFIX}threadweaver ) @@ -540,6 +542,25 @@ else (_kdeBootStrapping) endif (_kdeBootStrapping) + +################### try to find Phonon ############################################ + +# we do this here instead of above together with the checks for Perl etc. +# since FindPhonon.cmake also uses ${KDE4_LIB_INSTALL_DIR} to check for Phonon, +# which helps with finding the phonon installed as part of kdesupport: + +# only make Phonon REQUIRED if KDE4 itself is REQUIRED +find_package(Phonon ${_REQ_STRING_KDE4}) +set(KDE4_PHONON_LIBRARY ${PHONON_LIBRARY}) +set(KDE4_PHONON_LIBS ${PHONON_LIBS}) +set(KDE4_PHONON_INCLUDES ${PHONON_INCLUDES}) + +if(NOT PHONON_FOUND) + message(STATUS "KDE4 not found, because Phonon was not found") + return() +endif(NOT PHONON_FOUND) + + ##################### provide some options ########################################## option(KDE4_ENABLE_FINAL "Enable final all-in-one compilation") @@ -801,7 +822,7 @@ if (WIN32) # windows, microsoft compiler if(MSVC) - set( _KDE4_PLATFORM_DEFINITIONS -DKDE_FULL_TEMPLATE_EXPORT_INSTANTIATION -DWIN32_LEAN_AND_MEAN -DUNICODE ) + set( _KDE4_PLATFORM_DEFINITIONS -DKDE_FULL_TEMPLATE_EXPORT_INSTANTIATION -DWIN32_LEAN_AND_MEAN ) # C4250: 'class1' : inherits 'class2::member' via dominance set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4250" ) # C4251: 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' @@ -826,6 +847,9 @@ if (WIN32) set(CMAKE_MSVCIDE_RUN_PATH "${PERL_PATH_WINDOWS}\;${QT_BIN_DIR_WINDOWS}" CACHE STATIC "MSVC IDE Run path" FORCE) endif(MSVC_IDE) + + # we don't support anything below w2k and all winapi calls are unicodes + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x0501 -DUNICODE" ) endif (WIN32) @@ -967,12 +991,12 @@ endif(MSVC) if (CMAKE_COMPILER_IS_GNUCXX) set (KDE4_ENABLE_EXCEPTIONS -fexceptions) # Select flags. - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG -DQT_NO_DEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG -DQT_NO_DEBUG") set(CMAKE_CXX_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline") set(CMAKE_CXX_FLAGS_DEBUGFULL "-g3 -fno-inline") set(CMAKE_CXX_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG -DQT_NO_DEBUG") set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG -DQT_NO_DEBUG") set(CMAKE_C_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline") set(CMAKE_C_FLAGS_DEBUGFULL "-g3 -fno-inline") @@ -1115,13 +1139,13 @@ macro (KDE4_PRINT_RESULTS) # inside kdelibs the include dir and lib dir are internal, not "found" if (NOT _kdeBootStrapping) if(KDE4_INCLUDE_DIR) - message(STATUS "Found KDE 4.2 include dir: ${KDE4_INCLUDE_DIR}") + message(STATUS "Found KDE 4.3 include dir: ${KDE4_INCLUDE_DIR}") else(KDE4_INCLUDE_DIR) message(STATUS "ERROR: unable to find the KDE 4 headers") endif(KDE4_INCLUDE_DIR) if(KDE4_LIB_DIR) - message(STATUS "Found KDE 4.2 library dir: ${KDE4_LIB_DIR}") + message(STATUS "Found KDE 4.3 library dir: ${KDE4_LIB_DIR}") else(KDE4_LIB_DIR) message(STATUS "ERROR: unable to find the KDE 4 core library") endif(KDE4_LIB_DIR) @@ -1155,11 +1179,6 @@ if (KDE4Internal_FIND_REQUIRED AND NOT KDE4_FOUND) message(FATAL_ERROR "ERROR: could NOT find everything required for compiling KDE 4 programs") endif (KDE4Internal_FIND_REQUIRED AND NOT KDE4_FOUND) -find_package(Phonon REQUIRED) -set(KDE4_PHONON_LIBRARY ${PHONON_LIBRARY}) -set(KDE4_PHONON_LIBS ${PHONON_LIBS}) -set(KDE4_PHONON_INCLUDES ${PHONON_INCLUDES}) - if (NOT KDE4Internal_FIND_QUIETLY) kde4_print_results() endif (NOT KDE4Internal_FIND_QUIETLY) diff --git a/modules/FindKdcraw.cmake b/modules/FindKdcraw.cmake index dfd901c5..2eb0814f 100644 --- a/modules/FindKdcraw.cmake +++ b/modules/FindKdcraw.cmake @@ -26,12 +26,12 @@ else (KDCRAW_INCLUDE_DIR AND KDCRAW_LIBRARIES) # Check if library is not in local sub-folder - FIND_FILE(KDCRAW_LOCAL_FOUND libkdcraw/version.h ${CMAKE_BINARY_DIR}/libkdcraw ${CMAKE_BINARY_DIR}/libs/libkdcraw NO_DEFAULT_PATH) + FIND_FILE(KDCRAW_LOCAL_FOUND libkdcraw/kdcraw.h ${CMAKE_SOURCE_DIR}/libkdcraw ${CMAKE_SOURCE_DIR}/libs/libkdcraw NO_DEFAULT_PATH) if (KDCRAW_LOCAL_FOUND) # Was it found in libkdcraw/ or in libs/libkdcraw? - FIND_FILE(KDCRAW_LOCAL_FOUND_IN_LIBS libkdcraw/version.h ${CMAKE_BINARY_DIR}/libs/libkdcraw NO_DEFAULT_PATH) + FIND_FILE(KDCRAW_LOCAL_FOUND_IN_LIBS libkdcraw/kdcraw.h ${CMAKE_SOURCE_DIR}/libs/libkdcraw NO_DEFAULT_PATH) if (KDCRAW_LOCAL_FOUND_IN_LIBS) set(KDCRAW_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/libs/libkdcraw) else (KDCRAW_LOCAL_FOUND_IN_LIBS) diff --git a/modules/FindKdepim.cmake b/modules/FindKdepim.cmake deleted file mode 100644 index d04886af..00000000 --- a/modules/FindKdepim.cmake +++ /dev/null @@ -1,31 +0,0 @@ -# cmake macro to see if we have kdepim installed - -# KDEPIM_INCLUDE_DIR -# KDEPIM_FOUND -# Copyright (C) 2007 Laurent Montel <montel@kde.org> -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -if (KDEPIM_INCLUDE_DIR) - # Already in cache, be silent - set(KDEPIM_FOUND TRUE) -endif (KDEPIM_INCLUDE_DIR) - - -FIND_PATH(KDEPIM_INCLUDE_DIR NAMES kdepimprotocols.h - PATHS - ${INCLUDE_INSTALL_DIR} -) - -FIND_LIBRARY(KDEPIM_LIBRARIES NAMES kdepim - PATHS - ${LIB_INSTALL_DIR} -) - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Kdepim DEFAULT_MSG KDEPIM_LIBRARIES KDEPIM_INCLUDE_DIR ) - -MARK_AS_ADVANCED(KDEPIM_INCLUDE_DIR KDEPIM_LIBRARIES) - diff --git a/modules/FindKdepimLibs.cmake b/modules/FindKdepimLibs.cmake index 3ab58e21..dcbe2f94 100644 --- a/modules/FindKdepimLibs.cmake +++ b/modules/FindKdepimLibs.cmake @@ -3,6 +3,7 @@ # # KDEPIMLIBS_FOUND - system has KDE PIM Libraries # KDEPIMLIBS_INCLUDE_DIR - the KDE PIM Libraries include directory +# KDEPIMLIBS_INCLUDE_DIRS - the KDE PIM Libraries include directory and CamelCase headers # # It also sets variables for the following libraries: # KDEPIMLIBS_AKONADI_LIBS @@ -12,6 +13,7 @@ # KDEPIMLIBS_KABC_LIBS # KDEPIMLIBS_KBLOG_LIBS # KDEPIMLIBS_KCAL_LIBS +# KDEPIMLIBS_KHOLIDAYS_LIBS # KDEPIMLIBS_KIMAP_LIBS # KDEPIMLIBS_KLDAP_LIBS # KDEPIMLIBS_KMIME_LIBS @@ -29,6 +31,7 @@ # KDEPIMLIBS_DBUS_INTERFACES_DIR # KDEPIMLIBS_DBUS_SERVICES_DIR # KDEPIMLIBS_INCLUDE_DIR +# KDEPIMLIBS_INCLUDE_DIRS # KDEPIMLIBS_LIB_DIR # KDEPIMLIBS_BIN_DIR # KDEPIMLIBS_LIBEXEC_DIR diff --git a/modules/FindLCMS.cmake b/modules/FindLCMS.cmake index 9d162d2c..cbb6b179 100644 --- a/modules/FindLCMS.cmake +++ b/modules/FindLCMS.cmake @@ -17,7 +17,7 @@ # in the FIND_PATH() and FIND_LIBRARY() calls if(NOT WIN32) find_package(PkgConfig) - pkg_check_modules(PC_LCMS lcms) + pkg_check_modules(PC_LCMS QUIET lcms) set(LCMS_DEFINITIONS ${PC_LCMS_CFLAGS_OTHER}) endif(NOT WIN32) diff --git a/modules/FindLibArt.cmake b/modules/FindLibArt.cmake index 99eaff65..b14cd9db 100644 --- a/modules/FindLibArt.cmake +++ b/modules/FindLibArt.cmake @@ -23,7 +23,7 @@ else (LIBART_INCLUDE_DIR AND LIBART_LIBRARIES) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls - pkg_check_modules(PC_LIBART libart-2.0) + pkg_check_modules(PC_LIBART QUIET libart-2.0) ######### ?? where is this used ?? ############### set(LIBART_DEFINITIONS ${PC_LIBART_CFLAGS_OTHER}) diff --git a/modules/FindLibKonq.cmake b/modules/FindLibKonq.cmake index f9a06d2f..eaf4c08f 100644 --- a/modules/FindLibKonq.cmake +++ b/modules/FindLibKonq.cmake @@ -4,36 +4,19 @@ # LIBKONQ_FOUND - system has libkonq library # LIBKONQ_INCLUDE_DIR - the LIBKONQ include directory # LIBKONQ_LIBRARY - the libkonq library -# + # Original file: FindMarbleWidget.cmake (found in digikam-0.10.0-beta2) # copyright 2008 by Patrick Spendrin <ps_ml@gmx.de> +# Copyright (c) 2009, Alexander Neundorf, <neundorf@kde.org> # use this file as you like # # Modifications to find libkonq by Joachim Eibl 2008 -if(LIBKONQ_INCLUDE_DIR AND LIBKONQ_LIBRARY) - - # Already in cache - set(LIBKONQ_FOUND TRUE) - -else(LIBKONQ_INCLUDE_DIR AND LIBKONQ_LIBRARY) - find_path(LIBKONQ_INCLUDE_DIR konq_popupmenuplugin.h ) - - find_library(LIBKONQ_LIBRARY konq) +find_path(LIBKONQ_INCLUDE_DIR konq_popupmenuplugin.h ) - if(LIBKONQ_INCLUDE_DIR AND LIBKONQ_LIBRARY) - set(LIBKONQ_FOUND TRUE) - endif(LIBKONQ_INCLUDE_DIR AND LIBKONQ_LIBRARY) +find_library(LIBKONQ_LIBRARY konq) - if(LIBKONQ_FOUND) - if (NOT LIBKONQ_FIND_QUIETLY) - message(STATUS "Found libkonq: ${LIBKONQ_LIBRARY}") - endif (NOT LIBKONQ_FIND_QUIETLY) - else(LIBKONQ_FOUND) - if(LIBKONQ_FIND_REQUIRED) - message(FATAL_ERROR "Could NOT find KDE4 libkonq library") - endif(LIBKONQ_FIND_REQUIRED) - endif(LIBKONQ_FOUND) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LIBKONQ DEFAULT_MSG LIBKONQ_INCLUDE_DIR LIBKONQ_LIBRARY ) - mark_as_advanced(LIBKONQ_INCLUDE_DIR LIBKONQ_LIBRARY) -endif(LIBKONQ_INCLUDE_DIR AND LIBKONQ_LIBRARY) +mark_as_advanced(LIBKONQ_INCLUDE_DIR LIBKONQ_LIBRARY) diff --git a/modules/FindLibLZMA.cmake b/modules/FindLibLZMA.cmake new file mode 100644 index 00000000..1a341b28 --- /dev/null +++ b/modules/FindLibLZMA.cmake @@ -0,0 +1,45 @@ +# - Find LibLZMA +# Find LibLZMA headers and library +# +# LIBLZMA_FOUND - True if liblzma is found. +# LIBLZMA_INCLUDE_DIRS - Directory where liblzma headers are located. +# LIBLZMA_LIBRARIES - Lzma libraries to link against. +# LIBLZMA_HAS_AUTO_DECODER - True if lzma_auto_decoder() is found (required). +# LIBLZMA_HAS_EASY_ENCODER - True if lzma_easy_encoder() is found (required). +# LIBLZMA_HAS_LZMA_PRESET - True if lzma_lzma_preset() is found (required). + + +# Copyright (c) 2008, Per Øyvind Karlsen, <peroyvind@mandriva.org> +# Copyright (c) 2009, Alexander Neundorf, <neundorf@kde.org> +# Copyright (c) 2009, Helio Chissini de Castro, <helio@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +FIND_PATH(LIBLZMA_INCLUDE_DIR lzma.h ) +FIND_LIBRARY(LIBLZMA_LIBRARY lzma) + +SET(LIBLZMA_LIBRARIES ${LIBLZMA_LIBRARY}) +SET(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_INCLUDE_DIR}) + + +# We're using new code known now as XZ, even library still been called LZMA +# it can be found in http://tukaani.org/xz/ +# Avoid using old codebase +IF (LIBLZMA_LIBRARIES) + INCLUDE(CheckLibraryExists) + CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARIES} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER) + CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARIES} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER) + CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARIES} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET) +ENDIF (LIBLZMA_LIBRARIES) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBLZMA DEFAULT_MSG LIBLZMA_INCLUDE_DIR + LIBLZMA_LIBRARY + LIBLZMA_HAS_AUTO_DECODER + LIBLZMA_HAS_EASY_ENCODER + LIBLZMA_HAS_LZMA_PRESET + ) + +MARK_AS_ADVANCED( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY ) diff --git a/modules/FindLibXml2.cmake b/modules/FindLibXml2.cmake index 453c261b..83858047 100644 --- a/modules/FindLibXml2.cmake +++ b/modules/FindLibXml2.cmake @@ -22,7 +22,7 @@ IF (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls FIND_PACKAGE(PkgConfig) - PKG_CHECK_MODULES(PC_LIBXML libxml-2.0) + PKG_CHECK_MODULES(PC_LIBXML QUIET libxml-2.0) SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER}) ENDIF (NOT WIN32) diff --git a/modules/FindLibXslt.cmake b/modules/FindLibXslt.cmake index 3a1bcd46..1c55c4c5 100644 --- a/modules/FindLibXslt.cmake +++ b/modules/FindLibXslt.cmake @@ -22,7 +22,7 @@ IF (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(PC_XSLT libxslt) + pkg_check_modules(PC_XSLT QUIET libxslt) SET(LIBXSLT_DEFINITIONS ${PC_XSLT_CFLAGS_OTHER}) ENDIF (NOT WIN32) diff --git a/modules/FindOpenEXR.cmake b/modules/FindOpenEXR.cmake index eb3829cb..405b892d 100644 --- a/modules/FindOpenEXR.cmake +++ b/modules/FindOpenEXR.cmake @@ -21,7 +21,7 @@ else (OPENEXR_INCLUDE_DIR AND OPENEXR_LIBRARIES) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(PC_OPENEXR OpenEXR) + pkg_check_modules(PC_OPENEXR QUIET OpenEXR) FIND_PATH(OPENEXR_INCLUDE_DIR ImfRgbaFile.h HINTS diff --git a/modules/FindOpenSSL.cmake b/modules/FindOpenSSL.cmake index 1b915530..4ce8321b 100644 --- a/modules/FindOpenSSL.cmake +++ b/modules/FindOpenSSL.cmake @@ -32,7 +32,7 @@ FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h ) FIND_LIBRARY_WITH_DEBUG(OPENSSL_LIBRARIES WIN32_DEBUG_POSTFIX d - NAMES ssl ssleay ssleay32 ssleay32MD) + NAMES ssl ssleay ssleay32 libssleay32 ssleay32MD) IF(WIN32) OPENSSL_ADD_LIB_EAY_LIBS() diff --git a/modules/FindPCRE.cmake b/modules/FindPCRE.cmake index efba0652..c8f8326d 100644 --- a/modules/FindPCRE.cmake +++ b/modules/FindPCRE.cmake @@ -22,7 +22,7 @@ if (NOT WIN32) # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(PC_PCRE libpcre) + pkg_check_modules(PC_PCRE QUIET libpcre) set(PCRE_DEFINITIONS ${PC_PCRE_CFLAGS_OTHER}) diff --git a/modules/FindPkgConfig.cmake b/modules/FindPkgConfig.cmake new file mode 100644 index 00000000..b2f5ea57 --- /dev/null +++ b/modules/FindPkgConfig.cmake @@ -0,0 +1,376 @@ +# - a pkg-config module for CMake +# +# Usage: +# pkg_check_modules(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*) +# checks for all the given modules +# +# pkg_search_module(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*) +# checks for given modules and uses the first working one +# +# When the 'REQUIRED' argument was set, macros will fail with an error +# when module(s) could not be found +# +# When the 'QUIET' argument is set, no error message will be output if +# the package was not found. +# +# It sets the following variables: +# PKG_CONFIG_FOUND ... true if pkg-config works on the system +# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program +# <PREFIX>_FOUND ... set to 1 if module(s) exist +# +# For the following variables two sets of values exist; first one is the +# common one and has the given PREFIX. The second set contains flags +# which are given out when pkgconfig was called with the '--static' +# option. +# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l') +# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L') +# <XPREFIX>_LDFLAGS ... all required linker flags +# <XPREFIX>_LDFLAGS_OTHER ... all other linker flags +# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I') +# <XPREFIX>_CFLAGS ... all required cflags +# <XPREFIX>_CFLAGS_OTHER ... the other compiler flags +# +# <XPREFIX> = <PREFIX> for common case +# <XPREFIX> = <PREFIX>_STATIC for static linking +# +# There are some special variables whose prefix depends on the count +# of given modules. When there is only one module, <PREFIX> stays +# unchanged. When there are multiple modules, the prefix will be +# changed to <PREFIX>_<MODNAME>: +# <XPREFIX>_VERSION ... version of the module +# <XPREFIX>_PREFIX ... prefix-directory of the module +# <XPREFIX>_INCLUDEDIR ... include-dir of the module +# <XPREFIX>_LIBDIR ... lib-dir of the module +# +# <XPREFIX> = <PREFIX> when |MODULES| == 1, else +# <XPREFIX> = <PREFIX>_<MODNAME> +# +# A <MODULE> parameter can have the following formats: +# {MODNAME} ... matches any version +# {MODNAME}>={VERSION} ... at least version <VERSION> is required +# {MODNAME}={VERSION} ... exactly version <VERSION> is required +# {MODNAME}<={VERSION} ... modules must not be newer than <VERSION> +# +# Examples +# pkg_check_modules (GLIB2 glib-2.0) +# +# pkg_check_modules (GLIB2 glib-2.0>=2.10) +# requires at least version 2.10 of glib2 and defines e.g. +# GLIB2_VERSION=2.10.3 +# +# pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0) +# requires both glib2 and gtk2, and defines e.g. +# FOO_glib-2.0_VERSION=2.10.3 +# FOO_gtk+-2.0_VERSION=2.8.20 +# +# pkg_check_modules (XRENDER REQUIRED xrender) +# defines e.g.: +# XRENDER_LIBRARIES=Xrender;X11 +# XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp +# +# pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2) + + +# Copyright (C) 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> +# +# Redistribution and use, with or without modification, are permitted +# provided that the following conditions are met: +# +# 1. Redistributions must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# 2. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Modified for KDE use from cmake 2.6.2 version, to add QUIET option to +# pkg_check_modules(). +# Copyright (c) 2009, David Jarvie <djarvie@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + + +### Common stuff #### +set(PKG_CONFIG_VERSION 1) +set(PKG_CONFIG_FOUND 0) + +find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable") +mark_as_advanced(PKG_CONFIG_EXECUTABLE) + +if(PKG_CONFIG_EXECUTABLE) + set(PKG_CONFIG_FOUND 1) +endif(PKG_CONFIG_EXECUTABLE) + + +# Unsets the given variables +macro(_pkgconfig_unset var) + set(${var} "" CACHE INTERNAL "") +endmacro(_pkgconfig_unset) + +macro(_pkgconfig_set var value) + set(${var} ${value} CACHE INTERNAL "") +endmacro(_pkgconfig_set) + +# Invokes pkgconfig, cleans up the result and sets variables +macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp) + set(_pkgconfig_invoke_result) + + execute_process( + COMMAND ${PKG_CONFIG_EXECUTABLE} ${ARGN} ${_pkglist} + OUTPUT_VARIABLE _pkgconfig_invoke_result + RESULT_VARIABLE _pkgconfig_failed) + + if (_pkgconfig_failed) + set(_pkgconfig_${_varname} "") + _pkgconfig_unset(${_prefix}_${_varname}) + else(_pkgconfig_failed) + string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") + string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") + + if (NOT ${_regexp} STREQUAL "") + string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") + endif(NOT ${_regexp} STREQUAL "") + + separate_arguments(_pkgconfig_invoke_result) + + #message(STATUS " ${_varname} ... ${_pkgconfig_invoke_result}") + set(_pkgconfig_${_varname} ${_pkgconfig_invoke_result}) + _pkgconfig_set(${_prefix}_${_varname} "${_pkgconfig_invoke_result}") + endif(_pkgconfig_failed) +endmacro(_pkgconfig_invoke) + +# Invokes pkgconfig two times; once without '--static' and once with +# '--static' +macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp) + _pkgconfig_invoke("${_pkglist}" ${_prefix} ${_varname} "${cleanup_regexp}" ${ARGN}) + _pkgconfig_invoke("${_pkglist}" ${_prefix} STATIC_${_varname} "${cleanup_regexp}" --static ${ARGN}) +endmacro(_pkgconfig_invoke_dyn) + +# Splits given arguments into options and a package list +macro(_pkgconfig_parse_options _result _is_req _is_silent) + set(${_is_req} 0) + set(${_is_silent} 0) + + foreach(_pkg ${ARGN}) + if (_pkg STREQUAL "REQUIRED") + set(${_is_req} 1) + endif (_pkg STREQUAL "REQUIRED") + if (_pkg STREQUAL "QUIET") + set(${_is_silent} 1) + endif (_pkg STREQUAL "QUIET") + endforeach(_pkg ${ARGN}) + + set(${_result} ${ARGN}) + list(REMOVE_ITEM ${_result} "REQUIRED") + list(REMOVE_ITEM ${_result} "QUIET") +endmacro(_pkgconfig_parse_options) + +### +macro(_pkg_check_modules_internal _is_required _is_silent _prefix) + _pkgconfig_unset(${_prefix}_FOUND) + _pkgconfig_unset(${_prefix}_VERSION) + _pkgconfig_unset(${_prefix}_PREFIX) + _pkgconfig_unset(${_prefix}_INCLUDEDIR) + _pkgconfig_unset(${_prefix}_LIBDIR) + _pkgconfig_unset(${_prefix}_LIBS) + _pkgconfig_unset(${_prefix}_LIBS_L) + _pkgconfig_unset(${_prefix}_LIBS_PATHS) + _pkgconfig_unset(${_prefix}_LIBS_OTHER) + _pkgconfig_unset(${_prefix}_CFLAGS) + _pkgconfig_unset(${_prefix}_CFLAGS_I) + _pkgconfig_unset(${_prefix}_CFLAGS_OTHER) + _pkgconfig_unset(${_prefix}_STATIC_LIBDIR) + _pkgconfig_unset(${_prefix}_STATIC_LIBS) + _pkgconfig_unset(${_prefix}_STATIC_LIBS_L) + _pkgconfig_unset(${_prefix}_STATIC_LIBS_PATHS) + _pkgconfig_unset(${_prefix}_STATIC_LIBS_OTHER) + _pkgconfig_unset(${_prefix}_STATIC_CFLAGS) + _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_I) + _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_OTHER) + + # create a better addressable variable of the modules and calculate its size + set(_pkg_check_modules_list ${ARGN}) + list(LENGTH _pkg_check_modules_list _pkg_check_modules_cnt) + + if(PKG_CONFIG_EXECUTABLE) + # give out status message telling checked module + if (NOT ${_is_silent}) + if (_pkg_check_modules_cnt EQUAL 1) + message(STATUS "checking for module '${_pkg_check_modules_list}'") + else(_pkg_check_modules_cnt EQUAL 1) + message(STATUS "checking for modules '${_pkg_check_modules_list}'") + endif(_pkg_check_modules_cnt EQUAL 1) + endif(NOT ${_is_silent}) + + set(_pkg_check_modules_packages) + set(_pkg_check_modules_failed) + + # iterate through module list and check whether they exist and match the required version + foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list}) + set(_pkg_check_modules_exist_query) + + # check whether version is given + if (_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*") + string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\1" _pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}") + string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\2" _pkg_check_modules_pkg_op "${_pkg_check_modules_pkg}") + string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\3" _pkg_check_modules_pkg_ver "${_pkg_check_modules_pkg}") + else(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*") + set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}") + set(_pkg_check_modules_pkg_op) + set(_pkg_check_modules_pkg_ver) + endif(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*") + + # handle the operands + if (_pkg_check_modules_pkg_op STREQUAL ">=") + list(APPEND _pkg_check_modules_exist_query --atleast-version) + endif(_pkg_check_modules_pkg_op STREQUAL ">=") + + if (_pkg_check_modules_pkg_op STREQUAL "=") + list(APPEND _pkg_check_modules_exist_query --exact-version) + endif(_pkg_check_modules_pkg_op STREQUAL "=") + + if (_pkg_check_modules_pkg_op STREQUAL "<=") + list(APPEND _pkg_check_modules_exist_query --max-version) + endif(_pkg_check_modules_pkg_op STREQUAL "<=") + + # create the final query which is of the format: + # * --atleast-version <version> <pkg-name> + # * --exact-version <version> <pkg-name> + # * --max-version <version> <pkg-name> + # * --exists <pkg-name> + if (_pkg_check_modules_pkg_op) + list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}") + else(_pkg_check_modules_pkg_op) + list(APPEND _pkg_check_modules_exist_query --exists) + endif(_pkg_check_modules_pkg_op) + + _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION) + _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_PREFIX) + _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_INCLUDEDIR) + _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_LIBDIR) + + list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_name}") + list(APPEND _pkg_check_modules_packages "${_pkg_check_modules_pkg_name}") + + # execute the query + execute_process( + COMMAND ${PKG_CONFIG_EXECUTABLE} ${_pkg_check_modules_exist_query} + RESULT_VARIABLE _pkgconfig_retval) + + # evaluate result and tell failures + if (_pkgconfig_retval) + if(NOT ${_is_silent}) + message(STATUS " package '${_pkg_check_modules_pkg}' not found") + endif(NOT ${_is_silent}) + + set(_pkg_check_modules_failed 1) + endif(_pkgconfig_retval) + endforeach(_pkg_check_modules_pkg) + + if(_pkg_check_modules_failed) + # fail when requested + if (${_is_required}) + message(SEND_ERROR "A required package was not found") + endif (${_is_required}) + else(_pkg_check_modules_failed) + # when we are here, we checked whether requested modules + # exist. Now, go through them and set variables + + _pkgconfig_set(${_prefix}_FOUND 1) + list(LENGTH _pkg_check_modules_packages pkg_count) + + # iterate through all modules again and set individual variables + foreach (_pkg_check_modules_pkg ${_pkg_check_modules_packages}) + # handle case when there is only one package required + if (pkg_count EQUAL 1) + set(_pkg_check_prefix "${_prefix}") + else(pkg_count EQUAL 1) + set(_pkg_check_prefix "${_prefix}_${_pkg_check_modules_pkg}") + endif(pkg_count EQUAL 1) + + _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion ) + _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix ) + _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir ) + _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir ) + + message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") + endforeach(_pkg_check_modules_pkg) + + # set variables which are combined for multiple modules + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS "(^| )-L" --libs-only-L ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other ) + + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )-I" --cflags-only-I ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other ) + endif(_pkg_check_modules_failed) + else(PKG_CONFIG_EXECUTABLE) + if (${_is_required}) + message(SEND_ERROR "pkg-config tool not found") + endif (${_is_required}) + endif(PKG_CONFIG_EXECUTABLE) +endmacro(_pkg_check_modules_internal) + +### +### User visible macros start here +### + +### +macro(pkg_check_modules _prefix _module0) + # check cached value + if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) + _pkgconfig_parse_options (_pkg_modules _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN}) + _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" "${_prefix}" ${_pkg_modules}) + + _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) + endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) +endmacro(pkg_check_modules) + +### +macro(pkg_search_module _prefix _module0) + # check cached value + if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) + set(_pkg_modules_found 0) + _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN}) + + message(STATUS "checking for one of the modules '${_pkg_modules_alt}'") + + # iterate through all modules and stop at the first working one. + foreach(_pkg_alt ${_pkg_modules_alt}) + if(NOT _pkg_modules_found) + _pkg_check_modules_internal(0 1 "${_prefix}" "${_pkg_alt}") + endif(NOT _pkg_modules_found) + + if (${_prefix}_FOUND) + set(_pkg_modules_found 1) + endif(${_prefix}_FOUND) + endforeach(_pkg_alt) + + if (NOT ${_prefix}_FOUND) + if(${_pkg_is_required}) + message(SEND_ERROR "None of the required '${_pkg_modules_alt}' found") + endif(${_pkg_is_required}) + endif(NOT ${_prefix}_FOUND) + + _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) + endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) +endmacro(pkg_search_module) + +### Local Variables: +### mode: cmake +### End: diff --git a/modules/FindPulseAudio.cmake b/modules/FindPulseAudio.cmake new file mode 100644 index 00000000..dbb1f6b5 --- /dev/null +++ b/modules/FindPulseAudio.cmake @@ -0,0 +1,76 @@ +# Try to find the PulseAudio library +# +# Once done this will define: +# +# PULSEAUDIO_FOUND - system has the PulseAudio library +# PULSEAUDIO_INCLUDE_DIR - the PulseAudio include directory +# PULSEAUDIO_LIBRARY - the libraries needed to use PulseAudio +# PULSEAUDIO_MAINLOOP_LIBRARY - the libraries needed to use PulsAudio Mailoop +# +# Copyright (c) 2008, Matthias Kretz, <kretz@kde.org> +# Copyright (c) 2009, Marcus Hufgard, <Marcus.Hufgard@hufgard.de> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if (NOT PULSEAUDIO_MINIMUM_VERSION) + set(PULSEAUDIO_MINIMUM_VERSION "0.9.9") +endif (NOT PULSEAUDIO_MINIMUM_VERSION) + +if (PULSEAUDIO_INCLUDE_DIR AND PULSEAUDIO_LIBRARY AND PULSEAUDIO_MAINLOOP_LIBRARY) + # Already in cache, be silent + set(PULSEAUDIO_FIND_QUIETLY TRUE) +endif (PULSEAUDIO_INCLUDE_DIR AND PULSEAUDIO_LIBRARY AND PULSEAUDIO_MAINLOOP_LIBRARY) + +if (NOT WIN32) + include(FindPkgConfig) + pkg_check_modules(PC_PULSEAUDIO QUIET libpulse>=${PULSEAUDIO_MINIMUM_VERSION}) + pkg_check_modules(PC_PULSEAUDIO_MAINLOOP QUIET libpulse-mainloop-glib) +endif (NOT WIN32) + +FIND_PATH(PULSEAUDIO_INCLUDE_DIR pulse/pulseaudio.h + HINTS + ${PC_PULSEAUDIO_INCLUDEDIR} + ${PC_PULSEAUDIO_INCLUDE_DIRS} + ) + +FIND_LIBRARY(PULSEAUDIO_LIBRARY NAMES pulse libpulse + HINTS + ${PC_PULSEAUDIO_LIBDIR} + ${PC_PULSEAUDIO_LIBRARY_DIRS} + ) + +FIND_LIBRARY(PULSEAUDIO_MAINLOOP_LIBRARY NAMES pulse-mainloop pulse-mainloop-glib libpulse-mainloop-glib + HINTS + ${PC_PULSEAUDIO_LIBDIR} + ${PC_PULSEAUDIO_LIBRARY_DIRS} + ) + +if (PULSEAUDIO_INCLUDE_DIR AND PULSEAUDIO_LIBRARY) + include(MacroEnsureVersion) + + # get PulseAudio's version from its version.h, and compare it with our minimum version + file(STRINGS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h" pulse_version_h + REGEX ".*pa_get_headers_version\\(\\).*" + ) + string(REGEX REPLACE ".*pa_get_headers_version\\(\\)\ \\(\"([0-9]+\\.[0-9]+\\.[0-9]+)\"\\).*" "\\1" + PULSEAUDIO_VERSION "${pulse_version_h}") + macro_ensure_version("${PULSEAUDIO_MINIMUM_VERSION}" "${PULSEAUDIO_VERSION}" PULSEAUDIO_FOUND) +else (PULSEAUDIO_INCLUDE_DIR AND PULSEAUDIO_LIBRARY) + set(PULSEAUDIO_FOUND FALSE) +endif (PULSEAUDIO_INCLUDE_DIR AND PULSEAUDIO_LIBRARY) + +if (PULSEAUDIO_FOUND) + if (NOT PULSEAUDIO_FIND_QUIETLY) + message(STATUS "Found PulseAudio: ${PULSEAUDIO_LIBRARY}") + if (PULSEAUDIO_MAINLOOP_LIBRARY) + message(STATUS "Found PulseAudio Mainloop: ${PULSEAUDIO_MAINLOOP_LIBRARY}") + else (PULSAUDIO_MAINLOOP_LIBRARY) + message(STATUS "Could NOT find PulseAudio Mainloop Library") + endif (PULSEAUDIO_MAINLOOP_LIBRARY) + endif (NOT PULSEAUDIO_FIND_QUIETLY) +else (PULSEAUDIO_FOUND) + message(STATUS "Could NOT find PulseAudio") +endif (PULSEAUDIO_FOUND) + +mark_as_advanced(PULSEAUDIO_INCLUDE_DIR PULSEAUDIO_LIBRARY PULSEAUDIO_MAINLOOP_LIBRARY) diff --git a/modules/FindPyKDE4.cmake b/modules/FindPyKDE4.cmake index f738741e..dd2b7380 100644 --- a/modules/FindPyKDE4.cmake +++ b/modules/FindPyKDE4.cmake @@ -156,5 +156,9 @@ ENDMACRO(PYKDE4_INSTALL_PYTHON_FILES) # executable. # MACRO(PYKDE4_ADD_EXECUTABLE _pyname _exename) - INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -DTARGET=${DATA_INSTALL_DIR}/${PROJECT_NAME}/${_pyname} -DLINK_NAME=${BIN_INSTALL_DIR}/${_exename} -P ${CMAKE_SOURCE_DIR}/cmake/modules/create_exe_symlink.cmake)" ) + if(NOT ${PROJECT_NAME}) + MESSAGE(STATUS "Project name is necessary to create symlink against python program!!! It will failed.") + endif(NOT ${PROJECT_NAME}) + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -DTARGET=${DATA_INSTALL_DIR}/${PROJECT_NAME}/${_pyname} -DLINK_NAME=${BIN_INSTALL_DIR}/${_exename} -P ${current_module_dir}/create_exe_symlink.cmake)" ) ENDMACRO(PYKDE4_ADD_EXECUTABLE) + diff --git a/modules/FindPythonLibrary.cmake b/modules/FindPythonLibrary.cmake index 80f3f4ab..d98cb621 100644 --- a/modules/FindPythonLibrary.cmake +++ b/modules/FindPythonLibrary.cmake @@ -3,12 +3,12 @@ # Find the Python interpreter and related Python directories. # # This file defines the following variables: -# +# # PYTHON_EXECUTABLE - The path and filename of the Python interpreter. # # PYTHON_SHORT_VERSION - The version of the Python interpreter found, # excluding the patch version number. (e.g. 2.5 and not 2.5.1)) -# +# # PYTHON_LONG_VERSION - The version of the Python interpreter found as a human # readable string. # @@ -43,7 +43,13 @@ else(EXISTS PYTHON_LIBRARY) STRING(REGEX REPLACE ".*\nshort_version:([^\n]+).*$" "\\1" PYTHON_SHORT_VERSION ${python_config}) STRING(REGEX REPLACE ".*\nlong_version:([^\n]+).*$" "\\1" PYTHON_LONG_VERSION ${python_config}) STRING(REGEX REPLACE ".*\npy_inc_dir:([^\n]+).*$" "\\1" PYTHON_INCLUDE_PATH ${python_config}) - STRING(REGEX REPLACE ".*\nsite_packages_dir:([^\n]+).*$" "\\1" PYTHON_SITE_PACKAGES_DIR ${python_config}) + if(NOT PYTHON_SITE_PACKAGES_DIR) + if(NOT PYTHON_LIBS_WITH_KDE_LIBS) + STRING(REGEX REPLACE ".*\nsite_packages_dir:([^\n]+).*$" "\\1" PYTHON_SITE_PACKAGES_DIR ${python_config}) + else(NOT PYTHON_LIBS_WITH_KDE_LIBS) + set(PYTHON_SITE_PACKAGES_DIR ${KDE4_LIB_INSTALL_DIR}/python${PYTHON_SHORT_VERSION}/site-packages) + endif(NOT PYTHON_LIBS_WITH_KDE_LIBS) + endif(NOT PYTHON_SITE_PACKAGES_DIR) STRING(REGEX REPLACE "([0-9]+).([0-9]+)" "\\1\\2" PYTHON_SHORT_VERSION_NO_DOT ${PYTHON_SHORT_VERSION}) set(PYTHON_LIBRARY_NAMES python${PYTHON_SHORT_VERSION} python${PYTHON_SHORT_VERSION_NO_DOT}) if(WIN32) diff --git a/modules/FindQCA2.cmake b/modules/FindQCA2.cmake index 9966c224..478105f4 100644 --- a/modules/FindQCA2.cmake +++ b/modules/FindQCA2.cmake @@ -26,7 +26,7 @@ else (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES) if (NOT WIN32) find_package(PkgConfig) - pkg_check_modules(PC_QCA2 qca2) + pkg_check_modules(PC_QCA2 QUIET qca2) set(QCA2_DEFINITIONS ${PC_QCA2_CFLAGS_OTHER}) endif (NOT WIN32) diff --git a/modules/FindQImageBlitz.cmake b/modules/FindQImageBlitz.cmake index 9e31c047..232d7c40 100644 --- a/modules/FindQImageBlitz.cmake +++ b/modules/FindQImageBlitz.cmake @@ -20,7 +20,7 @@ if (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(PC_QIMAGEBLITZ qimageblitz) + pkg_check_modules(PC_QIMAGEBLITZ QUIET qimageblitz) endif (NOT WIN32) find_path(QIMAGEBLITZ_INCLUDES diff --git a/modules/FindSoprano.cmake b/modules/FindSoprano.cmake index fc00a9c9..fb84c2e4 100644 --- a/modules/FindSoprano.cmake +++ b/modules/FindSoprano.cmake @@ -16,6 +16,7 @@ # SOPRANO_PLUGIN_RAPTORSERIALIZER_FOUND - true if the raptorserializer plugin is found # SOPRANO_PLUGIN_REDLANDBACKEND_FOUND - true if the redlandbackend plugin is found # SOPRANO_PLUGIN_SESAME2BACKEND_FOUND - true if the sesame2backend plugin is found +# SOPRANO_PLUGIN_VIRTUOSOBACKEND_FOUND - true if the virtuosobackend plugin is found # # Options: # Set SOPRANO_MIN_VERSION to set the minimum required Soprano version (default: 1.99) @@ -41,44 +42,44 @@ find_path(SOPRANO_INCLUDE_DIR NAMES soprano/soprano.h - PATHS - ${KDE4_INCLUDE_DIR} + HINTS ${INCLUDE_INSTALL_DIR} + ${KDE4_INCLUDE_DIR} ) find_library_with_debug(SOPRANO_INDEX_LIBRARIES WIN32_DEBUG_POSTFIX d NAMES sopranoindex - PATHS - ${KDE4_LIB_DIR} + HINTS ${LIB_INSTALL_DIR} + ${KDE4_LIB_DIR} ) find_library_with_debug(SOPRANO_CLIENT_LIBRARIES WIN32_DEBUG_POSTFIX d NAMES sopranoclient - PATHS - ${KDE4_LIB_DIR} + HINTS ${LIB_INSTALL_DIR} + ${KDE4_LIB_DIR} ) find_library_with_debug(SOPRANO_LIBRARIES WIN32_DEBUG_POSTFIX d NAMES soprano - PATHS - ${KDE4_LIB_DIR} + HINTS ${LIB_INSTALL_DIR} + ${KDE4_LIB_DIR} ) find_library_with_debug(SOPRANO_SERVER_LIBRARIES WIN32_DEBUG_POSTFIX d NAMES sopranoserver - PATHS - ${KDE4_LIB_DIR} + HINTS ${LIB_INSTALL_DIR} + ${KDE4_LIB_DIR} ) # check for all the libs as required to make sure that we do not try to compile with an old version @@ -121,14 +122,18 @@ endif(SOPRANO_VERSION STRLESS "${SOPRANO_MIN_VERSION}") endif(SOPRANO_VERSION_MATCH) endif(Soprano_FOUND) - + + #look for parser plugins if(Soprano_FOUND) find_path(SOPRANO_PLUGIN_DIR NAMES soprano/plugins PATHS - ${SHARE_INSTALL_PREFIX} /usr/share /usr/local/share + ${SOPRANO_INCLUDE_DIR}/../share + ${SHARE_INSTALL_PREFIX} + /usr/share + /usr/local/share NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ) @@ -164,11 +169,16 @@ set(_plugins "${_plugins} sesame2backend") endif(EXISTS ${SOPRANO_PLUGIN_DIR}/sesame2backend.desktop) + if(EXISTS ${SOPRANO_PLUGIN_DIR}/virtuosobackend.desktop) + set(SOPRANO_PLUGIN_VIRTUOSOBACKEND_FOUND TRUE) + set(_plugins "${_plugins} virtuosobackend") + endif(EXISTS ${SOPRANO_PLUGIN_DIR}/virtuosobackend.desktop) + endif(Soprano_FOUND) if(Soprano_FOUND) if(NOT Soprano_FIND_QUIETLY) - message(STATUS "Found Soprano: ${SOPRANO_LIBRARIES}") + message(STATUS "Found Soprano version ${SOPRANO_VERSION}: ${SOPRANO_LIBRARIES}") message(STATUS "Found Soprano includes: ${SOPRANO_INCLUDE_DIR}") message(STATUS "Found Soprano Index: ${SOPRANO_INDEX_LIBRARIES}") message(STATUS "Found Soprano Client: ${SOPRANO_CLIENT_LIBRARIES}") @@ -178,10 +188,10 @@ else(Soprano_FOUND) if(Soprano_FIND_REQUIRED) if(NOT SOPRANO_INCLUDE_DIR) - message(FATAL_ERROR "Could not find Soprano includes.") + message(FATAL_ERROR "Could not find Soprano includes.") endif(NOT SOPRANO_INCLUDE_DIR) if(NOT SOPRANO_LIBRARIES) - message(FATAL_ERROR "Could not find Soprano library.") + message(FATAL_ERROR "Could not find Soprano library.") endif(NOT SOPRANO_LIBRARIES) else(Soprano_FIND_REQUIRED) if(NOT SOPRANO_INCLUDE_DIR) @@ -193,6 +203,11 @@ endif(Soprano_FIND_REQUIRED) endif(Soprano_FOUND) -mark_as_advanced(SOPRANO_CLIENT_LIBRARIES SOPRANO_INDEX_LIBRARIES SOPRANO_LIBRARIES SOPRANO_SERVER_LIBRARIES SOPRANO_INCLUDE_DIR ) +mark_as_advanced(SOPRANO_CLIENT_LIBRARIES + SOPRANO_INDEX_LIBRARIES + SOPRANO_LIBRARIES + SOPRANO_SERVER_LIBRARIES + SOPRANO_INCLUDE_DIR + SOPRANO_PLUGIN_DIR) #endif(SOPRANO_INCLUDE_DIR AND SOPRANO_LIBRARIES AND SOPRANO_INDEX_LIBRARIES AND SOPRANO_SERVER_LIBRARIES) diff --git a/modules/FindSqlite.cmake b/modules/FindSqlite.cmake index 2fa76330..dc36457b 100644 --- a/modules/FindSqlite.cmake +++ b/modules/FindSqlite.cmake @@ -25,7 +25,7 @@ endif ( SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES ) if( NOT WIN32 ) find_package(PkgConfig) - pkg_check_modules(PC_SQLITE sqlite3) + pkg_check_modules(PC_SQLITE QUIET sqlite3) set(SQLITE_DEFINITIONS ${PC_SQLITE_CFLAGS_OTHER}) endif( NOT WIN32 ) diff --git a/modules/FindStrigi.cmake b/modules/FindStrigi.cmake index f0a3921e..57f2199b 100644 --- a/modules/FindStrigi.cmake +++ b/modules/FindStrigi.cmake @@ -55,7 +55,7 @@ else(STRIGI_CONFIG_FOUND_AND_HAS_COMPLETE_INFORMATION) if(NOT strigi_home) find_package(PkgConfig) if(PKG_CONFIG_EXECUTABLE) - pkg_check_modules(STRIGI libstreamanalyzer>=${STRIGI_MIN_VERSION}) + pkg_check_modules(STRIGI QUIET libstreamanalyzer>=${STRIGI_MIN_VERSION}) endif(PKG_CONFIG_EXECUTABLE) endif(NOT strigi_home) endif(NOT WIN32) @@ -173,8 +173,14 @@ endif(WIN32) mark_as_advanced( STRIGI_INCLUDE_DIR STRIGI_STREAMANALYZER_LIBRARY + STRIGI_STREAMANALYZER_LIBRARY_DEBUG + STRIGI_STREAMANALYZER_LIBRARY_RELEASE STRIGI_STREAMS_LIBRARY + STRIGI_STREAMS_LIBRARY_DEBUG + STRIGI_STREAMS_LIBRARY_RELEASE STRIGI_STRIGIQTDBUSCLIENT_LIBRARY + STRIGI_STRIGIQTDBUSCLIENT_LIBRARY_DEBUG + STRIGI_STRIGIQTDBUSCLIENT_LIBRARY_RELEASE STRIGI_LINE_ANALYZER_PREFIX STRIGI_THROUGH_ANALYZER_PREFIX STRIGI_NEEDS_SIGNED_CHAR diff --git a/modules/FindUSB.cmake b/modules/FindUSB.cmake index 566cdd8e..dfcf650c 100644 --- a/modules/FindUSB.cmake +++ b/modules/FindUSB.cmake @@ -21,7 +21,7 @@ else (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(PC_LIBUSB libusb) + pkg_check_modules(PC_LIBUSB QUIET libusb) ENDIF(NOT WIN32) FIND_PATH(LIBUSB_INCLUDE_DIR usb.h diff --git a/modules/FindXine.cmake b/modules/FindXine.cmake index 1223851b..4ad0c2a8 100644 --- a/modules/FindXine.cmake +++ b/modules/FindXine.cmake @@ -21,7 +21,7 @@ endif (XINE_INCLUDE_DIR AND XINE_LIBRARY) find_package(PkgConfig) if (PKG_CONFIG_FOUND) - pkg_check_modules(PC_LIBXINE libxine) + pkg_check_modules(PC_LIBXINE QUIET libxine) endif (PKG_CONFIG_FOUND) find_path(XINE_INCLUDE_DIR NAMES xine.h diff --git a/modules/FindXmms.cmake b/modules/FindXmms.cmake index c43893fb..9f2cdf26 100644 --- a/modules/FindXmms.cmake +++ b/modules/FindXmms.cmake @@ -22,7 +22,7 @@ else (XMMS_INCLUDE_DIRS AND XMMS_LIBRARIES) # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(PC_XMMS xmms) + pkg_check_modules(PC_XMMS QUIET xmms) endif(NOT WIN32) find_path(XMMS_INCLUDE_DIRS xmmsctrl.h diff --git a/modules/HandleImportedTargetsInCMakeRequiredLibraries.cmake b/modules/HandleImportedTargetsInCMakeRequiredLibraries.cmake new file mode 100644 index 00000000..28564ab6 --- /dev/null +++ b/modules/HandleImportedTargetsInCMakeRequiredLibraries.cmake @@ -0,0 +1,81 @@ + +# This is a helper function used by CheckCXXSourceRuns.cmake and +# CheckCXXSourceCompiles.cmake. Actually it should be used by all macros which +# use TRY_COMPILE() or TRY_RUN(). +# It takes the CMAKE_REQUIRED_LIBRARY variable and searches it for imported +# (library) targets. Since the project created by TRY_COMPILE() (and TRY_RUN()) +# does not know about these imported targets, this macro here replaces these +# imported targets with the actual library files on disk and it also +# adds the libraries from the link interface of these imported targets. +# E.g the imported target KDE4__kdeui is replaced on my system with /opt/kdelibs/lib/libkdeui.so +# and the link interface libraries, which includes e.g. /opt/kdelibs/lib/libkdecore.so. +# This way imported targets work also when used with CHECK_CXX_SOURCE_COMPILES/RUNS(). + +# Copyright (c) 2009, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +FUNCTION(HANDLE_IMPORTED_TARGETS_IN_CMAKE_REQUIRED_LIBRARIES _RESULT) +# handle imported library targets + SET(_CCSR_IMP_TARGETS_MAP) + SET(_CCSR_REQ_LIBS ${CMAKE_REQUIRED_LIBRARIES}) + SET(_CHECK_FOR_IMPORTED_TARGETS TRUE) + SET(_CCSR_LOOP_COUNTER 0) + WHILE(_CHECK_FOR_IMPORTED_TARGETS) + MATH(EXPR _CCSR_LOOP_COUNTER "${_CCSR_LOOP_COUNTER} + 1 ") + SET(_CCSR_NEW_REQ_LIBS ) + SET(_CHECK_FOR_IMPORTED_TARGETS FALSE) + FOREACH(_CURRENT_LIB ${_CCSR_REQ_LIBS}) + GET_TARGET_PROPERTY(_importedConfigs ${_CURRENT_LIB} IMPORTED_CONFIGURATIONS) + IF (_importedConfigs) + # Ok, so this is an imported target. + # First we get the imported configurations. + # Then we get the location of the actual library on disk of the first configuration. + # then we'll get its link interface libraries property, + # iterate through it and replace all imported targets we find there + # with there actual location. + + # guard against infinite loop: abort after 100 iterations ( 100 is arbitrary chosen) + IF ("${_CCSR_LOOP_COUNTER}" LESS 100) + SET(_CHECK_FOR_IMPORTED_TARGETS TRUE) +# ELSE ("${_CCSR_LOOP_COUNTER}" LESS 1) +# MESSAGE(STATUS "********* aborting loop, counter : ${_CCSR_LOOP_COUNTER}") + ENDIF ("${_CCSR_LOOP_COUNTER}" LESS 100) + + LIST(GET _importedConfigs 0 _firstImportedConfig) + GET_TARGET_PROPERTY(_firstImportedLocation ${_CURRENT_LIB} LOCATION_${_firstImportedConfig}) + GET_TARGET_PROPERTY(_linkInterfaceLibs ${_CURRENT_LIB} IMPORTED_LINK_INTERFACE_LIBRARIES_${_firstImportedConfig} ) + + LIST(APPEND _CCSR_NEW_REQ_LIBS ${_firstImportedLocation}) +# MESSAGE(STATUS "Appending lib ${_CURRENT_LIB} as ${_firstImportedLocation}") + FOREACH(_currentLinkInterfaceLib ${_linkInterfaceLibs}) +# MESSAGE(STATUS "Appending link interface lib ${_currentLinkInterfaceLib}") + LIST(APPEND _CCSR_NEW_REQ_LIBS ${_currentLinkInterfaceLib} ) + ENDFOREACH(_currentLinkInterfaceLib ${_linkInterfaceLibs}) + ELSE(_importedConfigs) + # "Normal" libraries are just used as they are. + LIST(APPEND _CCSR_NEW_REQ_LIBS ${_CURRENT_LIB} ) +# MESSAGE(STATUS "Appending lib directly: ${_CURRENT_LIB}") + ENDIF(_importedConfigs) + ENDFOREACH(_CURRENT_LIB ${_CCSR_REQ_LIBS}) + + SET(_CCSR_REQ_LIBS ${_CCSR_NEW_REQ_LIBS} ) + ENDWHILE(_CHECK_FOR_IMPORTED_TARGETS) + + # Finally we iterate once more over all libraries. This loop only removes + # all remaining imported target names (there shouldn't be any left anyway). + SET(_CCSR_NEW_REQ_LIBS ) + FOREACH(_CURRENT_LIB ${_CCSR_REQ_LIBS}) + GET_TARGET_PROPERTY(_importedConfigs ${_CURRENT_LIB} IMPORTED_CONFIGURATIONS) + IF (NOT _importedConfigs) + LIST(APPEND _CCSR_NEW_REQ_LIBS ${_CURRENT_LIB} ) +# MESSAGE(STATUS "final: appending ${_CURRENT_LIB}") + ELSE (NOT _importedConfigs) +# MESSAGE(STATUS "final: skipping ${_CURRENT_LIB}") + ENDIF (NOT _importedConfigs) + ENDFOREACH(_CURRENT_LIB ${_CCSR_REQ_LIBS}) + SET(${_RESULT} ${_CCSR_NEW_REQ_LIBS} PARENT_SCOPE) + +ENDFUNCTION(HANDLE_IMPORTED_TARGETS_IN_CMAKE_REQUIRED_LIBRARIES _CCSR_REQ_LIBS) + diff --git a/modules/KDE4CTestNightlySetup.cmake b/modules/KDE4CTestNightlySetup.cmake deleted file mode 100644 index 4c21a583..00000000 --- a/modules/KDE4CTestNightlySetup.cmake +++ /dev/null @@ -1,102 +0,0 @@ -# The following variables have to be set before including this file: -# CTEST_CMAKE_GENERATOR -# CTEST_UPDATE_TYPE (if update from cvs or svn is required) -# SVN_REPOSITORY or CVS_REPOSITORY and CVS_MODULE -# -# If the project doesn't build with spaces in the path, do the following: -# set(CTEST_AVOID_SPACES TRUE) -# -# After this file has been included, the regular new style ctest -# scripting commands can be used, e.g. -# -# ctest_empty_binary_directory("${CTEST_BINARY_DIRECTORY}") -# ctest_start(Nightly) -# ctest_update(SOURCE "${CTEST_SOURCE_DIRECTORY}" ) -# ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" ) -# ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" ) -# ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" ) -# ctest_submit() - - - - -set(currentDirectory "${CTEST_SCRIPT_DIRECTORY}") - -if(NOT EXISTS "${currentDirectory}/CMakeLists.txt") - message(FATAL_ERROR "This macro must be called from a cmake script in the source tree of your project.") -endif(NOT EXISTS "${currentDirectory}/CMakeLists.txt") - -include("${currentDirectory}/CTestConfig.cmake") -include("${currentDirectory}/CTestCustom.cmake" OPTIONAL) - -# Set up the directories where the dashboards will be created -# By default this will be "$HOME/Dashboards/<project>/(src|build) dir". -# It can be overriden by the user. -set(DASHBOARD_DIR "$ENV{HOME}/Dashboards" ) - -if(NOT DEFINED CTEST_SOURCE_DIRECTORY) - if(CTEST_AVOID_SPACES) - set(CTEST_SOURCE_DIRECTORY "${DASHBOARD_DIR}/${CTEST_PROJECT_NAME}/srcdir" ) - else(CTEST_AVOID_SPACES) - set(CTEST_SOURCE_DIRECTORY "${DASHBOARD_DIR}/${CTEST_PROJECT_NAME}/src dir" ) - endif(CTEST_AVOID_SPACES) -endif(NOT DEFINED CTEST_SOURCE_DIRECTORY) - -if(NOT DEFINED CTEST_BINARY_DIRECTORY) - if(CTEST_AVOID_SPACES) - set(CTEST_BINARY_DIRECTORY "${DASHBOARD_DIR}/${CTEST_PROJECT_NAME}/builddir" ) - else(CTEST_AVOID_SPACES) - set(CTEST_BINARY_DIRECTORY "${DASHBOARD_DIR}/${CTEST_PROJECT_NAME}/build dir" ) - endif(CTEST_AVOID_SPACES) -endif(NOT DEFINED CTEST_BINARY_DIRECTORY) - - - -site_name(CTEST_SITE) -if(NOT DEFINED CTEST_BUILD_NAME) - set(CTEST_BUILD_NAME ${CMAKE_SYSTEM_NAME}) -endif(NOT DEFINED CTEST_BUILD_NAME) - -if("${CTEST_CMAKE_GENERATOR}" MATCHES Makefile) - find_program(MAKE_EXECUTABLE make gmake) - set(CTEST_BUILD_COMMAND "${MAKE_EXECUTABLE}" ) -else("${CTEST_CMAKE_GENERATOR}" MATCHES Makefile) - if(NOT DEFINED CTEST_BUILD_COMMAND) - message(FATAL_ERROR "CTEST_CMAKE_GENERATOR is set to \"${CTEST_CMAKE_GENERATOR}\", but CTEST_BUILD_COMMAND has not been set") - endif(NOT DEFINED CTEST_BUILD_COMMAND) -endif("${CTEST_CMAKE_GENERATOR}" MATCHES Makefile) - -# set up version control - -string(TOLOWER ${CTEST_UPDATE_TYPE} _ctest_vcs) -set(_have_vcs FALSE) - -if ("${_ctest_vcs}" STREQUAL svn) - find_program(SVN_EXECUTABLE svn) - if (NOT SVN_EXECUTABLE) - message(FATAL_ERROR "Error: CTEST_UPDATE_TYPE is svn, but could not find svn executable") - endif (NOT SVN_EXECUTABLE) - if(NOT SVN_REPOSITORY) - message(FATAL_ERROR "Error: CTEST_UPDATE_TYPE is svn, but SVN_REPOSITORY is not set") - endif(NOT SVN_REPOSITORY) - set(CTEST_UPDATE_COMMAND ${SVN_EXECUTABLE}) - set(CTEST_CHECKOUT_COMMAND "${SVN_EXECUTABLE} co ${SVN_REPOSITORY} \"${CTEST_SOURCE_DIRECTORY}\"") - set(_have_vcs TRUE) -endif ("${_ctest_vcs}" STREQUAL svn) - -if ("${_ctest_vcs}" STREQUAL cvs) - find_program(CVS_EXECUTABLE cvs cvsnt) - if (NOT CVS_EXECUTABLE) - message(FATAL_ERROR "Error: CTEST_UPDATE_TYPE is cvs, but could not find cvs or cvsnt executable") - endif (NOT CVS_EXECUTABLE) - if (NOT CVS_REPOSITORY) - message(FATAL_ERROR "Error: CTEST_UPDATE_TYPE is cvs, but CVS_REPOSITORY is not set") - endif (NOT CVS_REPOSITORY) - if (NOT CVS_MODULE) - message(FATAL_ERROR "Error: CTEST_UPDATE_TYPE is cvs, but CVS_MODULE is not set") - endif (NOT CVS_MODULE) - - set(CTEST_UPDATE_COMMAND ${CVS_EXECUTABLE}) - set(CTEST_CHECKOUT_COMMAND "${CVS_EXECUTABLE} -d ${CVS_REPOSITORY} co -d \"${CTEST_SOURCE_DIRECTORY}\" ${CVS_MODULE}") - set(_have_vcs TRUE) -endif ("${_ctest_vcs}" STREQUAL cvs) diff --git a/modules/KDE4Defaults.cmake b/modules/KDE4Defaults.cmake index de56a822..1f2d07c0 100644 --- a/modules/KDE4Defaults.cmake +++ b/modules/KDE4Defaults.cmake @@ -7,7 +7,7 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/CTestConfig.cmake) endif (EXISTS ${CMAKE_SOURCE_DIR}/CTestConfig.cmake) # Always include srcdir and builddir in include path -# This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY} in about every subdir +# This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} in about every subdir # since cmake 2.4.0 set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -24,11 +24,11 @@ set(CMAKE_COLOR_MAKEFILE ON) # define the generic version of the libraries here # this makes it easy to advance it when the next KDE release comes # Use this version number for libraries which are at version n in KDE version n -set(GENERIC_LIB_VERSION "4.2.0") +set(GENERIC_LIB_VERSION "4.3.0") set(GENERIC_LIB_SOVERSION "4") # Use this version number for libraries which are already at version n+1 in KDE version n -set(KDE_NON_GENERIC_LIB_VERSION "5.2.0") +set(KDE_NON_GENERIC_LIB_VERSION "5.3.0") set(KDE_NON_GENERIC_LIB_SOVERSION "5") # windows does not support LD_LIBRARY_PATH or similar diff --git a/modules/KDE4Macros.cmake b/modules/KDE4Macros.cmake index 5533284b..ce310ebf 100644 --- a/modules/KDE4Macros.cmake +++ b/modules/KDE4Macros.cmake @@ -66,17 +66,25 @@ macro (KDE4_ADD_KCFG_FILES _sources ) get_filename_component(_basename ${_tmp_FILE} NAME_WE) file(READ ${_tmp_FILE} _contents) - string(REGEX REPLACE "^(.*\n)?File=([^\n]+kcfg).*\n.*$" "\\2" _kcfg_FILE "${_contents}") + string(REGEX REPLACE "^(.*\n)?File=([^\n]+kcfg).*\n.*$" "\\2" _kcfg_FILENAME "${_contents}") set(_src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) set(_header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) set(_moc_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc) + set(_kcfg_FILE ${_abs_PATH}/${_kcfg_FILENAME}) + # Maybe the .kcfg is a generated file? + if(NOT EXISTS "${_kcfg_FILE}") + set(_kcfg_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_kcfg_FILENAME}) + endif(NOT EXISTS "${_kcfg_FILE}") + if(NOT EXISTS "${_kcfg_FILE}") + message(ERROR "${_kcfg_FILENAME} not found; tried in ${_abs_PATH} and ${CMAKE_CURRENT_BINARY_DIR}") + endif(NOT EXISTS "${_kcfg_FILE}") # the command for creating the source file from the kcfg file add_custom_command(OUTPUT ${_header_FILE} ${_src_FILE} COMMAND ${KDE4_KCFGC_EXECUTABLE} - ARGS ${_abs_PATH}/${_kcfg_FILE} ${_tmp_FILE} -d ${CMAKE_CURRENT_BINARY_DIR} + ARGS ${_kcfg_FILE} ${_tmp_FILE} -d ${CMAKE_CURRENT_BINARY_DIR} MAIN_DEPENDENCY ${_tmp_FILE} - DEPENDS ${_abs_PATH}/${_kcfg_FILE} ${_KDE4_KCONFIG_COMPILER_DEP} ) + DEPENDS ${_kcfg_FILE} ${_KDE4_KCONFIG_COMPILER_DEP} ) if(_kcfg_generatemoc) qt4_generate_moc(${_header_FILE} ${_moc_FILE} ) @@ -826,7 +834,7 @@ macro (KDE4_ADD_EXECUTABLE _target_NAME) _automoc4_kde4_post_target_handling(${_target_NAME}) if (_test) - set_target_properties(${_target_NAME} PROPERTIES COMPILE_FLAGS -DKDESRCDIR="\\"${CMAKE_CURRENT_SOURCE_DIR}\\"") + set_target_properties(${_target_NAME} PROPERTIES COMPILE_FLAGS -DKDESRCDIR="\\"${CMAKE_CURRENT_SOURCE_DIR}/\\"") endif (_test) kde4_handle_rpath_for_executable(${_target_NAME} ${_type}) @@ -1016,7 +1024,7 @@ macro (KDE4_ADD_APP_ICON appsources pattern) endif(MSVC) if (PNG2ICO_EXECUTABLE AND WINDRES_EXECUTABLE) string(REPLACE "*" "(.*)" pattern_rx "${pattern}") - file(GLOB_RECURSE files "${pattern}") + file(GLOB files "${pattern}") foreach (it ${files}) string(REGEX REPLACE "${pattern_rx}" "\\1" fn "${it}") if (fn MATCHES ".*16.*" ) diff --git a/modules/MacroLogFeature.cmake b/modules/MacroLogFeature.cmake index 11861b95..5db50edf 100644 --- a/modules/MacroLogFeature.cmake +++ b/modules/MacroLogFeature.cmake @@ -26,6 +26,7 @@ # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> # Copyright (c) 2006, Allen Winter, <winter@kde.org> +# Copyright (c) 2009, Sebastian Trueg, <trueg@kde.org> # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. @@ -66,18 +67,26 @@ MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _ ENDIF (${_required} MATCHES "[Tt][Rr][Uu][Ee]") ENDIF (${_var}) - SET(_logtext "+ ${_package}") + SET(_logtext " * ${_package}") IF (NOT ${_var}) IF (${_minvers} MATCHES ".*") - SET(_logtext "${_logtext}, ${_minvers} or higher") + SET(_logtext "${_logtext} (${_minvers} or higher)") ENDIF (${_minvers} MATCHES ".*") - SET(_logtext "${_logtext}: ${_description} <${_url}>") + SET(_logtext "${_logtext} <${_url}>\n ") + ELSE (NOT ${_var}) + SET(_logtext "${_logtext} - ") + ENDIF (NOT ${_var}) + + SET(_logtext "${_logtext}${_description}") + + IF (NOT ${_var}) IF (${_comments} MATCHES ".*") - SET(_logtext "${_logtext}\n${_comments}") + SET(_logtext "${_logtext}\n ${_comments}") ENDIF (${_comments} MATCHES ".*") # SET(_logtext "${_logtext}\n") #double-space missing features? ENDIF (NOT ${_var}) + FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n") ENDMACRO(MACRO_LOG_FEATURE) @@ -85,41 +94,53 @@ ENDMACRO(MACRO_LOG_FEATURE) MACRO(MACRO_DISPLAY_FEATURE_LOG) - SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt) - IF (EXISTS ${_file}) - FILE(READ ${_file} _requirements) - MESSAGE(STATUS "\n-----------------------------------------------------------------------------\n-- The following REQUIRED packages could NOT be located on your system.\n-- Please install them before continuing this software installation.\n-----------------------------------------------------------------------------\n${_requirements}-----------------------------------------------------------------------------") - FILE(REMOVE ${_file}) - MESSAGE(FATAL_ERROR "Exiting: Missing Requirements") - ENDIF (EXISTS ${_file}) + SET(_missingFile ${CMAKE_BINARY_DIR}/MissingRequirements.txt) + SET(_enabledFile ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) + SET(_disabledFile ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) - SET(_summary "\n") + IF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile}) + SET(_printSummary TRUE) + ENDIF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile}) - SET(_elist 0) - SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) - IF (EXISTS ${_file}) - SET(_elist 1) - FILE(READ ${_file} _enabled) - FILE(REMOVE ${_file}) - SET(_summary "${_summary}-----------------------------------------------------------------------------\n-- The following external packages were located on your system.\n-- This installation will have the extra features provided by these packages.\n${_enabled}") - ENDIF (EXISTS ${_file}) + IF(_printSummary) + SET(_missingDeps 0) + IF (EXISTS ${_enabledFile}) + FILE(READ ${_enabledFile} _enabled) + FILE(REMOVE ${_enabledFile}) + SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following external packages were located on your system.\n-- This installation will have the extra features provided by these packages.\n-----------------------------------------------------------------------------\n${_enabled}") + ENDIF (EXISTS ${_enabledFile}) - SET(_dlist 0) - SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) - IF (EXISTS ${_file}) - SET(_dlist 1) - FILE(READ ${_file} _disabled) - FILE(REMOVE ${_file}) - SET(_summary "${_summary}-----------------------------------------------------------------------------\n-- The following OPTIONAL packages could NOT be located on your system.\n-- Consider installing them to enable more features from this software.\n${_disabled}") - ELSE (EXISTS ${_file}) - IF (${_elist}) - SET(_summary "${_summary}Congratulations! All external packages have been found.\n") - ENDIF (${_elist}) - ENDIF (EXISTS ${_file}) - IF (${_elist} OR ${_dlist}) - SET(_summary "${_summary}-----------------------------------------------------------------------------\n") - ENDIF (${_elist} OR ${_dlist}) - MESSAGE(STATUS "${_summary}") + IF (EXISTS ${_disabledFile}) + SET(_missingDeps 1) + FILE(READ ${_disabledFile} _disabled) + FILE(REMOVE ${_disabledFile}) + SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following OPTIONAL packages could NOT be located on your system.\n-- Consider installing them to enable more features from this software.\n-----------------------------------------------------------------------------\n${_disabled}") + ENDIF (EXISTS ${_disabledFile}) + + + IF (EXISTS ${_missingFile}) + SET(_missingDeps 1) + FILE(READ ${_missingFile} _requirements) + SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following REQUIRED packages could NOT be located on your system.\n-- You must install these packages before continuing.\n-----------------------------------------------------------------------------\n${_requirements}") + FILE(REMOVE ${_missingFile}) + SET(_haveMissingReq 1) + ENDIF (EXISTS ${_missingFile}) + + + IF (NOT ${_missingDeps}) + SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- Congratulations! All external packages have been found.") + ENDIF (NOT ${_missingDeps}) + + + MESSAGE(${_summary}) + MESSAGE("-----------------------------------------------------------------------------\n") + + + IF(_haveMissingReq) + MESSAGE(FATAL_ERROR "Exiting: Missing Requirements") + ENDIF(_haveMissingReq) + + ENDIF(_printSummary) ENDMACRO(MACRO_DISPLAY_FEATURE_LOG) diff --git a/modules/MacroOptionalAddSubdirectory.cmake b/modules/MacroOptionalAddSubdirectory.cmake index 32e25141..5de49f95 100644 --- a/modules/MacroOptionalAddSubdirectory.cmake +++ b/modules/MacroOptionalAddSubdirectory.cmake @@ -9,6 +9,12 @@ # subdirectory. # This is useful if you want to compile only a subset of all # directories. +# +# If the CMake variable DISABLE_ALL_OPTIONAL_SUBDIRECTORIES is set to TRUE +# for the first CMake run on the project, all optional subdirectories will be disabled +# by default (but can of course be enabled via the respective options). +# E.g. the following will disable all optional subdirectories except the one named "kcalc": +# $ cmake -DDISABLE_ALL_OPTIONAL_SUBDIRECTORIES=TRUE -DBUILD_kcalc=TRUE <srcdir> # Copyright (c) 2007, Alexander Neundorf, <neundorf@kde.org> # @@ -19,7 +25,11 @@ MACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY _dir ) GET_FILENAME_COMPONENT(_fullPath ${_dir} ABSOLUTE) IF(EXISTS ${_fullPath}) - SET(_DEFAULT_OPTION_VALUE TRUE) + IF(DISABLE_ALL_OPTIONAL_SUBDIRECTORIES) + SET(_DEFAULT_OPTION_VALUE FALSE) + ELSE(DISABLE_ALL_OPTIONAL_SUBDIRECTORIES) + SET(_DEFAULT_OPTION_VALUE TRUE) + ENDIF(DISABLE_ALL_OPTIONAL_SUBDIRECTORIES) IF(DISABLE_ALL_OPTIONAL_SUBDIRS AND NOT DEFINED BUILD_${_dir}) SET(_DEFAULT_OPTION_VALUE FALSE) ENDIF(DISABLE_ALL_OPTIONAL_SUBDIRS AND NOT DEFINED BUILD_${_dir}) diff --git a/modules/MacroOptionalDependPackage.cmake b/modules/MacroOptionalDependPackage.cmake index 1a6df36a..bc7b671b 100644 --- a/modules/MacroOptionalDependPackage.cmake +++ b/modules/MacroOptionalDependPackage.cmake @@ -13,10 +13,10 @@ MACRO (MACRO_OPTIONAL_DEPEND_PACKAGE _name _module_needed) set(_packagename Find${_name}.cmake) find_file(_PACKAGE_DEPEND_FOUND ${_packagename} PATHS ${CMAKE_MODULE_PATH} ) if(NOT _PACKAGE_DEPEND_FOUND) - MESSAGE(STATUS "cmake package ${_packagename} was not found. This package needs ${_module_needed} to be compile all program") - set(DEPEND_PACKAGE_${_name} FALSE) + MESSAGE(STATUS "optional cmake package ${_packagename} (for ${_module_needed}) was not found.") + set(DEPEND_PACKAGE_${_name} FALSE) else(NOT _PACKAGE_DEPEND_FOUND) - set(DEPEND_PACKAGE_${_name} TRUE) + set(DEPEND_PACKAGE_${_name} TRUE) endif(NOT _PACKAGE_DEPEND_FOUND) ENDMACRO (MACRO_OPTIONAL_DEPEND_PACKAGE) diff --git a/modules/check_installed_exports_file.cmake b/modules/check_installed_exports_file.cmake index 454d2a09..d1d0c718 100644 --- a/modules/check_installed_exports_file.cmake +++ b/modules/check_installed_exports_file.cmake @@ -1,27 +1,48 @@ -# INSTALL_DIR - set it to the install destination -# INSTALL_PREFIX - set it to CMAKE_INSTALL_PREFIX -# CURRENT_BINARY_DIR - set it to CMAKE_CURRENT_BINARY_DIR -# FILENAME - the filename of the exports file - -# get the absolute install directory, consider absolute and relative paths and also DESTDIR -if(IS_ABSOLUTE "${INSTALL_DIR}") - set(installDir "$ENV{DESTDIR}${INSTALL_DIR}") -else(IS_ABSOLUTE "${INSTALL_DIR}") - set(installDir "$ENV{DESTDIR}${INSTALL_PREFIX}/${INSTALL_DIR}") -endif(IS_ABSOLUTE "${INSTALL_DIR}") - -set(installedExportsFile "${installDir}/${FILENAME}") - - -# if the file already exists at the install location, and if we can -# find the exports file in the build dir, read both, and if their contents differ, -# remove all configuration-specific exports files from the install dir, since -# they may create conflicts if the new targets have been added/targets have been -# removed/ targets have been renamed/ the namespace for the exported targets has changed -if(EXISTS "${installedExportsFile}") - if (${INSTALL_DIR} MATCHES "^(/)(.+)$") - set(binaryDirExportFileDir "_${CMAKE_MATCH_2}") - set(binaryDirExportsFile "${CURRENT_BINARY_DIR}/CMakeFiles/Export/${binaryDirExportFileDir}/${FILENAME}") + +# This file is executed via install(SCRIPT). +# This means it is include()d into the cmake_install.cmake file +# Due to this the following variables already have the correct value: +# CMAKE_INSTALL_PREFIX +# CMAKE_CURRENT_BINARY_DIR +# +# Additionally the following two variables have to be set: +# EXPORT_INSTALL_DIR - set it to the install destination +# EXPORT_FILES - the filenames of the exports file +# +# Alex + + +# put all the code into a function so all variables used here are local +# which makes sure including this file multiple times in a cmake_install.cmake works +function(CHECK_INSTALLED_EXPORTS_FILE _filename) + + # get the absolute install directory, consider absolute and relative paths and also DESTDIR + if(IS_ABSOLUTE "${EXPORT_INSTALL_DIR}") + set(installDir "$ENV{DESTDIR}${EXPORT_INSTALL_DIR}") + else(IS_ABSOLUTE "${EXPORT_INSTALL_DIR}") + set(installDir "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${EXPORT_INSTALL_DIR}") + endif(IS_ABSOLUTE "${EXPORT_INSTALL_DIR}") + + set(installedExportsFile "${installDir}/${_filename}") + + #message(STATUS "************ bin dir: ${CMAKE_CURRENT_BINARY_DIR}") + #message(STATUS "************ prefix: ${CMAKE_INSTALL_PREFIX}") + #message(STATUS "************ exportsfile: ${installedExportsFile}") + + # if the file already exists at the install location, and if we can + # find the exports file in the build dir, read both, and if their contents differ, + # remove all configuration-specific exports files from the install dir, since + # they may create conflicts if the new targets have been added/targets have been + # removed/ targets have been renamed/ the namespace for the exported targets has changed + if(EXISTS "${installedExportsFile}") + if (${EXPORT_INSTALL_DIR} MATCHES "^(/)(.+)$") + set(binaryDirExportFileDir "_${CMAKE_MATCH_2}") + set(binaryDirExportsFile "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Export/${binaryDirExportFileDir}/${_filename}") + else (${EXPORT_INSTALL_DIR} MATCHES "^(/)(.+)$") + set(binaryDirExportsFile "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Export/${EXPORT_INSTALL_DIR}/${_filename}") + endif (${EXPORT_INSTALL_DIR} MATCHES "^(/)(.+)$") + + # message(STATUS "************* binaryDirExportsFile: ${binaryDirExportsFile}") if(EXISTS "${binaryDirExportsFile}") file(READ "${installedExportsFile}" installedExportsFileContents) @@ -29,16 +50,24 @@ if(EXISTS "${installedExportsFile}") if(NOT "${installedExportsFileContents}" STREQUAL "${binaryDirExportsFileContents}") - if("${FILENAME}" MATCHES "^(.+)(\\.cmake)$") - message(STATUS "Installed and new ${FILENAME} differ, removing installed ${CMAKE_MATCH_1}-*.cmake files") - file(GLOB files "${installDir}/${CMAKE_MATCH_1}-*.cmake") - file(REMOVE ${files}) - endif("${FILENAME}" MATCHES "^(.+)(\\.cmake)$") -# else(NOT "${installedExportsFileContents}" STREQUAL "${binaryDirExportsFileContents}") -# message(STATUS "FILES are the same") + if("${_filename}" MATCHES "^(.+)(\\.cmake)$") + message(STATUS "XXX Installed and new ${_filename} differ, removing installed ${CMAKE_MATCH_1}-*.cmake files") + file(GLOB exportFiles "${installDir}/${CMAKE_MATCH_1}-*.cmake") +# message(STATUS "XXX files: ${exportFiles}") + file(REMOVE ${exportFiles}) + endif("${_filename}" MATCHES "^(.+)(\\.cmake)$") + else(NOT "${installedExportsFileContents}" STREQUAL "${binaryDirExportsFileContents}") +# message(STATUS "XXX FILES ${_filename} are the same") endif(NOT "${installedExportsFileContents}" STREQUAL "${binaryDirExportsFileContents}") endif(EXISTS "${binaryDirExportsFile}") - endif (${INSTALL_DIR} MATCHES "^(/)(.+)$") -endif(EXISTS "${installedExportsFile}") + endif(EXISTS "${installedExportsFile}") + +endfunction(CHECK_INSTALLED_EXPORTS_FILE) + +# call the function for each exports file +foreach(_currentExportsFile ${EXPORT_FILES}) + check_installed_exports_file("${_currentExportsFile}") +endforeach(_currentExportsFile ${EXPORT_FILES}) + diff --git a/modules/create_exe_symlink.cmake b/modules/create_exe_symlink.cmake new file mode 100644 index 00000000..95db4b48 --- /dev/null +++ b/modules/create_exe_symlink.cmake @@ -0,0 +1,16 @@ +# Create an executable symlink to a Python script. +# This also sets the target script's permission bits. + +MESSAGE(STATUS "Symlinking $ENV{DESTDIR}/${LINK_NAME} to $ENV{DESTDIR}/${TARGET}") + +GET_FILENAME_COMPONENT(abs_link_name $ENV{DESTDIR}/${LINK_NAME} ABSOLUTE) +GET_FILENAME_COMPONENT(link_path $ENV{DESTDIR}/${LINK_NAME} PATH) +GET_FILENAME_COMPONENT(abs_link_path ${link_path} ABSOLUTE) +FILE(MAKE_DIRECTORY ${abs_link_path}) + +GET_FILENAME_COMPONENT(abs_target ${TARGET} ABSOLUTE) +IF(UNIX) + EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink ${abs_target} ${abs_link_name}) + EXECUTE_PROCESS(COMMAND chmod a+x ${abs_target}) +ENDIF(UNIX) +# FIXME: WIN32 support |