From: Manuel Nickschas Date: Sun, 16 Mar 2014 16:45:10 +0000 (+0100) Subject: Update currently bundled CMake scripts X-Git-Tag: 0.11.0~111 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=60f0c29382823c31a8574d343e2c6fa2f919cb43 Update currently bundled CMake scripts We still need to bundle some CMake scripts that are not part of a standard CMake installation, and may not be present in particular on non-UNIXy platforms (as e.g. Windows does not have the concept of a system-wide CMake script location). Let's use current versions of those. --- diff --git a/cmake/modules/FindDBusMenuQt.cmake b/cmake/modules/FindDBusMenuQt.cmake index 82673b7d..5af70ef2 100644 --- a/cmake/modules/FindDBusMenuQt.cmake +++ b/cmake/modules/FindDBusMenuQt.cmake @@ -1,10 +1,17 @@ # - Try to find dbusmenu-qt +# This module helps finding an installation of the DBusMenuQt library (see https://launchpad.net/libdbusmenu-qt/) # Once done this will define # # DBUSMENUQT_FOUND - system has dbusmenu-qt # DBUSMENUQT_INCLUDE_DIR - the dbusmenu-qt include directory # DBUSMENUQT_LIBRARIES - the libraries needed to use dbusmenu-qt # DBUSMENUQT_DEFINITIONS - Compiler switches required for using dbusmenu-qt +# +# The minimum required version of DBusMenuQt can be specified using the +# standard syntax, e.g. find_package(DBusMenuQt 0.6) +# +# WARNING: versions below 0.4.0 cannot be checked for. +# So if you want to have a version check, require at least 0.4.0 of dbusmenuqt. # Copyright (c) 2009, Canonical Ltd. # - Author: Aurélien Gâteau @@ -19,6 +26,8 @@ include(FindPackageHandleStandardArgs) find_package(PkgConfig) pkg_check_modules(PC_DBUSMENUQT QUIET dbusmenu-qt) + + set(DBUSMENUQT_DEFINITIONS ${PC_DBUSMENUQT_CFLAGS_OTHER}) find_library(DBUSMENUQT_LIBRARIES @@ -31,6 +40,55 @@ find_path(DBUSMENUQT_INCLUDE_DIR dbusmenuexporter.h PATH_SUFFIXES dbusmenu-qt ) -find_package_handle_standard_args(DBusMenuQt "Could not find dbusmenu-qt; available at https://launchpad.net/libdbusmenu-qt/" DBUSMENUQT_LIBRARIES DBUSMENUQT_INCLUDE_DIR) -mark_as_advanced(DBUSMENUQT_INCLUDE_DIR DBUSMENUQT_LIBRARIES) +# dbusmenu_version.h is installed since 0.4.0, fail if a version below this is required: +if ((DBusMenuQt_FIND_VERSION) AND ("${DBusMenuQt_FIND_VERSION}" VERSION_LESS "0.4.0")) + message(FATAL_ERROR "Cannot check reliably for a DBusMenuQt version below 0.4.0 (${DBusMenuQt_FIND_VERSION} was requested)") +endif ((DBusMenuQt_FIND_VERSION) AND ("${DBusMenuQt_FIND_VERSION}" VERSION_LESS "0.4.0")) + + +# find the version number from dbusmenu_version.h and store it in the cache +if(DBUSMENUQT_INCLUDE_DIR AND NOT DBUSMENUQT_VERSION) + # parse the version number out from dbusmenu_version: + if(EXISTS ${DBUSMENUQT_INCLUDE_DIR}/dbusmenu_version.h) + file(READ "${DBUSMENUQT_INCLUDE_DIR}/dbusmenu_version.h" DBUSMENUQT_VERSION_CONTENT) + + if ("${DBUSMENUQT_VERSION_CONTENT}" MATCHES "DBUSMENUQT_VERSION_MAJOR") # introduced after 0.6.4, makes this code here more robust + + string(REGEX MATCH "#define +DBUSMENUQT_VERSION_MAJOR +([0-9]+)" _dummy "${DBUSMENUQT_VERSION_CONTENT}") + set(DBUSMENUQT_VERSION_MAJOR "${CMAKE_MATCH_1}") + + string(REGEX MATCH "#define +DBUSMENUQT_VERSION_MINOR +([0-9]+)" _dummy "${DBUSMENUQT_VERSION_CONTENT}") + set(DBUSMENUQT_VERSION_MINOR "${CMAKE_MATCH_1}") + + string(REGEX MATCH "#define +DBUSMENUQT_VERSION_PATCH +([0-9]+)" _dummy "${DBUSMENUQT_VERSION_CONTENT}") + set(DBUSMENUQT_VERSION_PATCH "${CMAKE_MATCH_1}") + + else("${DBUSMENUQT_VERSION_CONTENT}" MATCHES "DBUSMENUQT_VERSION_MAJOR") + # In versions up to 0.6.4, the code for setting the version number in the header looked like + # shopw below. This made version checking quite un-obvious: + # #define DBUSMENUQT_VERSION \ + # ((0 << 16) \ + # |(6 << 8) \ + # |4) + + string(REGEX MATCH "\\(\\( *([0-9]+) *<<" _dummy "${DBUSMENUQT_VERSION_CONTENT}") + set(DBUSMENUQT_VERSION_MAJOR "${CMAKE_MATCH_1}") + + string(REGEX MATCH "\\|\\( *([0-9]+) *<<" _dummy "${DBUSMENUQT_VERSION_CONTENT}") + set(DBUSMENUQT_VERSION_MINOR "${CMAKE_MATCH_1}") + + string(REGEX MATCH "\\| *([0-9]+) *\\)" _dummy "${DBUSMENUQT_VERSION_CONTENT}") + set(DBUSMENUQT_VERSION_PATCH "${CMAKE_MATCH_1}") + endif("${DBUSMENUQT_VERSION_CONTENT}" MATCHES "DBUSMENUQT_VERSION_MAJOR") + endif(EXISTS ${DBUSMENUQT_INCLUDE_DIR}/dbusmenu_version.h) + + set(DBUSMENUQT_VERSION "${DBUSMENUQT_VERSION_MAJOR}.${DBUSMENUQT_VERSION_MINOR}.${DBUSMENUQT_VERSION_PATCH}" CACHE STRING "Version number of DBusMenuQt" FORCE) +endif(DBUSMENUQT_INCLUDE_DIR AND NOT DBUSMENUQT_VERSION) + + +find_package_handle_standard_args(DBusMenuQt REQUIRED_VARS DBUSMENUQT_LIBRARIES DBUSMENUQT_INCLUDE_DIR + VERSION_VAR DBUSMENUQT_VERSION) +#"Could not find dbusmenu-qt; available at https://launchpad.net/libdbusmenu-qt/" DBUSMENUQT_LIBRARIES DBUSMENUQT_INCLUDE_DIR) + +mark_as_advanced(DBUSMENUQT_INCLUDE_DIR DBUSMENUQT_LIBRARIES DBUSMENUQT_VERSION) diff --git a/cmake/modules/FindPhonon.cmake b/cmake/modules/FindPhonon.cmake index ab0a86c8..cd9e5cb4 100644 --- a/cmake/modules/FindPhonon.cmake +++ b/cmake/modules/FindPhonon.cmake @@ -19,50 +19,19 @@ macro(_phonon_find_version) file(READ ${_phonon_namespace_header_file} _phonon_header LIMIT 5000 OFFSET 1000) string(REGEX MATCH "define PHONON_VERSION_STR \"(4\\.[0-9]+\\.[0-9a-z]+)\"" _phonon_version_match "${_phonon_header}") set(PHONON_VERSION "${CMAKE_MATCH_1}") - message(STATUS "Phonon Version: ${PHONON_VERSION}") endmacro(_phonon_find_version) -if(PHONON_FOUND) - # Already found, nothing more to do except figuring out the version - _phonon_find_version() -else(PHONON_FOUND) - if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) - set(PHONON_FIND_QUIETLY TRUE) - endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) - - find_library(PHONON_LIBRARY_RELEASE NAMES phonon phonon4 HINTS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR}) - find_library(PHONON_LIBRARY_DEBUG NAMES phonond phonond4 HINTS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR}) - - # if the release- as well as the debug-version of the library have been found: - IF (PHONON_LIBRARY_DEBUG AND PHONON_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(PHONON_LIBRARY optimized ${PHONON_LIBRARY_RELEASE} debug ${PHONON_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(PHONON_LIBRARY ${PHONON_LIBRARY_RELEASE} ) - ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - ELSE(PHONON_LIBRARY_DEBUG AND PHONON_LIBRARY_RELEASE) - IF (PHONON_LIBRARY_RELEASE) - SET(PHONON_LIBRARY ${PHONON_LIBRARY_RELEASE}) - ENDIF (PHONON_LIBRARY_RELEASE) - ENDIF (PHONON_LIBRARY_DEBUG AND PHONON_LIBRARY_RELEASE) +# the dirs listed with HINTS are searched before the default sets of dirs +find_library(PHONON_LIBRARY NAMES phonon HINTS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR}) +find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h HINTS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ${QT_LIBRARY_DIR}) - find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h HINTS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ${QT_LIBRARY_DIR}) - - if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) - set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY}) - set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR}) - set(PHONON_FOUND TRUE) - _phonon_find_version() - else(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) - set(PHONON_FOUND FALSE) - endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) +if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) + set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY}) + set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR}) + _phonon_find_version() +endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Phonon DEFAULT_MSG PHONON_INCLUDE_DIR PHONON_LIBRARY) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Phonon DEFAULT_MSG PHONON_INCLUDE_DIR PHONON_LIBRARY) - mark_as_advanced(PHONON_INCLUDE_DIR PHONON_LIBRARY) -endif(PHONON_FOUND) +mark_as_advanced(PHONON_INCLUDE_DIR PHONON_LIBRARY) diff --git a/cmake/modules/FindQCA2.cmake b/cmake/modules/FindQCA2.cmake index cf000e46..e2d8f2a5 100644 --- a/cmake/modules/FindQCA2.cmake +++ b/cmake/modules/FindQCA2.cmake @@ -30,31 +30,11 @@ else (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES) set(QCA2_DEFINITIONS ${PC_QCA2_CFLAGS_OTHER}) endif (NOT WIN32) - find_library(QCA2_LIBRARIES_DEBUG - NAMES qcad qcad2 + find_library_with_debug(QCA2_LIBRARIES + WIN32_DEBUG_POSTFIX d + NAMES qca HINTS ${PC_QCA2_LIBDIR} ${PC_QCA2_LIBRARY_DIRS} ) - find_library(QCA2_LIBRARIES_RELEASE - NAMES qca qca2 - HINTS ${PC_QCA2_LIBDIR} ${PC_QCA2_LIBRARY_DIRS} - ) - # if the release- as well as the debug-version of the library have been found: - IF (QCA2_LIBRARIES_DEBUG AND QCA2_LIBRARIES_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(QCA2_LIBRARIES optimized ${QCA2_LIBRARIES_RELEASE} debug ${QCA2_LIBRARIES_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(QCA2_LIBRARIES ${QCA2_LIBRARIES_RELEASE} ) - ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - ELSE (QCA2_LIBRARIES_DEBUG AND QCA2_LIBRARIES_RELEASE) - IF (QCA2_LIBRARIES_RELEASE) - SET(QCA2_LIBRARIES ${QCA2_LIBRARIES_RELEASE}) - ENDIF (QCA2_LIBRARIES_RELEASE) - ENDIF (QCA2_LIBRARIES_DEBUG AND QCA2_LIBRARIES_RELEASE) - find_path(QCA2_INCLUDE_DIR QtCrypto HINTS ${PC_QCA2_INCLUDEDIR} ${PC_QCA2_INCLUDE_DIRS}