diff options
42 files changed, 1021 insertions, 274 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/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..1eddbb8f 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}) @@ -303,8 +301,18 @@ macro_ensure_version("0.9.87" "${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 +320,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) @@ -371,6 +375,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 +487,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 +541,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 +821,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 +846,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 +990,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 +1138,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 +1178,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/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/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/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..1f45f972 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) @@ -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,6 +169,11 @@ 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) @@ -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 |