set(DEBUG 1)
endif(upper_build_type STREQUAL "RELEASE" OR upper_build_type STREQUAL "RELWITHDEBUGINFO")
-if(WANT_MONO OR WANT_QTCLIENT)
- set(QT_MIN_VERSION "4.6.0")
-else(WANT_MONO OR WANT_QTCLIENT)
- set(QT_MIN_VERSION "4.4.0")
-endif(WANT_MONO OR WANT_QTCLIENT)
-
if(APPLE AND DEPLOY)
set(CMAKE_OSX_ARCHITECTURES "i386;ppc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.4")
add_definitions(-DMAC_10_4_SDK)
endif(APPLE AND DEPLOY)
+# Simplify checks
+if(WANT_MONO OR WANT_QTCLIENT)
+ set(BUILD_GUI true)
+endif(WANT_MONO OR WANT_QTCLIENT)
+if(WANT_MONO OR WANT_CORE)
+ set(BUILD_CORE true)
+endif(WANT_MONO OR WANT_CORE)
+
+# Dependencies
+##############
+
+# GUI stuff needs some new features
+if(BUILD_GUI)
+ set(QT_MIN_VERSION "4.6.0")
+else(BUILD_GUI)
+ set(QT_MIN_VERSION "4.4.0")
+endif(BUILD_GUI)
+
# Execinfo is needed for generating backtraces
find_package(ExecInfo)
if(EXECINFO_FOUND)
include(${QT_USE_FILE})
include_directories(${QT_INCLUDES})
+# PkgConfig isn't strictly required.
+# However, some optional deps might not be found if it's not present, so warn!
+find_package(PkgConfig)
+if(NOT PKG_CONFIG_FOUND)
+ message(STATUS "WARNING: PkgConfig not available! Some dependencies for optional features might not be found.")
+ message(STATUS " Affected features might include encryption support, DBus menus and Ayatana notifications.")
+endif(NOT PKG_CONFIG_FOUND)
+
# Setup OpenSSL
# We don't link to or include OpenSSL ourselves, but use exclusively the Qt API.
# Thus, we simply check if OpenSSL support is present in Qt's config and enable our
message(STATUS "Not enabling OpenSSL support")
endif(WITH_OPENSSL)
-# Setup D-Bus support
-if(WITH_DBUS)
- if(QT_QTDBUS_FOUND)
- message(STATUS "Found QtDBus, enabling D-Bus support")
- add_definitions(-DHAVE_DBUS)
- set(CLIENT_QT4_VARS ${CLIENT_QT4_VARS} DBUS)
- set(CLIENT_COMPILE_FLAGS "${CLIENT_COMPILE_FLAGS} -DQT_DBUS_LIB")
- set(HAVE_DBUS true)
- else(QT_QTDBUS_FOUND)
- message(STATUS "QtDBus not found, disabling D-Bus support")
- endif(QT_QTDBUS_FOUND)
-else(WITH_DBUS)
- message(STATUS "Not enabling D-Bus support")
-endif(WITH_DBUS)
-
-# Setup QtWebKit support
-if(WITH_WEBKIT)
- if(QT_QTWEBKIT_FOUND)
- message(STATUS "Found QtWebKit, enabling WebKit support")
- add_definitions(-DHAVE_WEBKIT)
- set(CLIENT_QT4_VARS ${CLIENT_QT4_VARS} WEBKIT XMLPATTERNS)
- set(CLIENT_COMPILE_FLAGS "${CLIENT_COMPILE_FLAGS} -DQT_WEBKIT_LIB -DQT_XMLPATTERNS_LIB")
- set(HAVE_WEBKIT true)
- else(QT_QTWEBKIT_FOUND)
- message(STATUS "QtWebKit not found, disabling WebKit support")
- endif(QT_QTWEBKIT_FOUND)
-else(WITH_WEBKIT)
- message(STATUS "Not enabling WebKit support")
-endif(WITH_WEBKIT)
-
-# Setup KDE4 support
-if(WITH_KDE)
- find_package(KDE4)
- if(KDE4_FOUND)
- message(STATUS "Enabling KDE4 integration")
- include_directories(${KDE4_INCLUDES})
- add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS})
- set(HAVE_KDE 1)
- set(QUASSEL_KDE_LIBRARIES ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBRARY} ${KDE4_SOLID_LIBS} knotifyconfig)
- # We always use external icons for KDE4 support, since we use its iconloader rather than our own
- set(EMBED_DATA OFF)
- else(KDE4_FOUND)
- message(STATUS "KDE4 not found, disabling KDE integration")
- endif(KDE4_FOUND)
-else(WITH_KDE)
- message(STATUS "Not enabling KDE4 integration")
-endif(WITH_KDE)
+# Check for GUI specific stuff
+if(BUILD_GUI)
+
+ # Setup D-Bus support
+ if(WITH_DBUS)
+ if(QT_QTDBUS_FOUND)
+ message(STATUS "Found QtDBus, enabling D-Bus support")
+ add_definitions(-DHAVE_DBUS)
+ set(CLIENT_QT4_VARS ${CLIENT_QT4_VARS} DBUS)
+ set(CLIENT_COMPILE_FLAGS "${CLIENT_COMPILE_FLAGS} -DQT_DBUS_LIB")
+ set(HAVE_DBUS true)
+ else(QT_QTDBUS_FOUND)
+ message(STATUS "QtDBus not found, disabling D-Bus support")
+ endif(QT_QTDBUS_FOUND)
+ else(WITH_DBUS)
+ message(STATUS "Not enabling D-Bus support")
+ endif(WITH_DBUS)
+
+ # Setup QtWebKit support
+ if(WITH_WEBKIT)
+ if(QT_QTWEBKIT_FOUND)
+ message(STATUS "Found QtWebKit, enabling WebKit support")
+ add_definitions(-DHAVE_WEBKIT)
+ set(CLIENT_QT4_VARS ${CLIENT_QT4_VARS} WEBKIT XMLPATTERNS)
+ set(CLIENT_COMPILE_FLAGS "${CLIENT_COMPILE_FLAGS} -DQT_WEBKIT_LIB -DQT_XMLPATTERNS_LIB")
+ set(HAVE_WEBKIT true)
+ else(QT_QTWEBKIT_FOUND)
+ message(STATUS "QtWebKit not found, disabling WebKit support")
+ endif(QT_QTWEBKIT_FOUND)
+ else(WITH_WEBKIT)
+ message(STATUS "Not enabling WebKit support")
+ endif(WITH_WEBKIT)
+
+ # Setup KDE4 support
+ if(WITH_KDE)
+ find_package(KDE4)
+ if(KDE4_FOUND)
+ message(STATUS "Enabling KDE4 integration")
+ include_directories(${KDE4_INCLUDES})
+ add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS})
+ set(HAVE_KDE 1)
+ set(QUASSEL_KDE_LIBRARIES ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBRARY} ${KDE4_SOLID_LIBS} knotifyconfig)
+ # We always use external icons for KDE4 support, since we use its iconloader rather than our own
+ set(EMBED_DATA OFF)
+ else(KDE4_FOUND)
+ message(STATUS "KDE4 not found, disabling KDE integration")
+ endif(KDE4_FOUND)
+ else(WITH_KDE)
+ message(STATUS "Not enabling KDE4 integration")
+ endif(WITH_KDE)
+
+ # Setup Phonon support - we only need this if we don't have or want KDE4
+ if(NOT HAVE_KDE)
+ if(WITH_PHONON)
+ find_package(Phonon)
+ if(PHONON_FOUND)
+ message(STATUS "Enabling Phonon support")
+ add_definitions(-DHAVE_PHONON)
+ set(HAVE_PHONON true)
+ else(PHONON_FOUND)
+ message(STATUS "Phonon not found, disabling audio notifications")
+ endif(PHONON_FOUND)
+ else(WITH_PHONON)
+ message(STATUS "Not enabling Phonon support")
+ endif(WITH_PHONON)
+ endif(NOT HAVE_KDE)
+
+ # Setup libindicate-qt support
+ if(WITH_LIBINDICATE)
+ pkg_check_modules(INDICATEQT QUIET indicate-qt>=0.2.1)
+ if(INDICATEQT_FOUND)
+ message(STATUS "Enabling Ayatana notification support")
+ set(HAVE_INDICATEQT true)
+ add_definitions(-DHAVE_INDICATEQT)
+ else(INDICATEQT_FOUND)
+ message(STATUS "Disabling Ayatana notification support")
+ endif(INDICATEQT_FOUND)
+ else(WITH_LIBINDICATE)
+ message(STATUS "Not enabling Ayatana notification support")
+ # We don't want to link against it even if another package has found it
+ set(INDICATEQT_LIBRARIES "")
+ endif(WITH_LIBINDICATE)
+
+endif(BUILD_GUI)
+
+# Core-only deps
+if(BUILD_CORE)
+
+ # Setup encryption support
+ if(WITH_CRYPT)
+ find_package(QCA2)
+ if(QCA2_FOUND)
+ message(STATUS "Found QCA2, enabling encryption support")
+ add_definitions(-DHAVE_QCA2)
+ set(LINK_QCA2 QCA2)
+ set(HAVE_QCA2 true)
+ set(MOC_DEFINES ${MOC_DEFINES} -DHAVE_QCA2)
+ else(QCA2_FOUND)
+ message(STATUS "QCA2 not found, disabling encryption support")
+ endif(QCA2_FOUND)
+ else(WITH_CRYPT)
+ message(STATUS "Not enabling encryption support")
+ endif(WITH_CRYPT)
+
+endif(BUILD_CORE)
# needed to compile with mingw without kde
if(MINGW AND NOT HAVE_KDE)
add_definitions(-U__STRICT_ANSI__)
endif(MINGW AND NOT HAVE_KDE)
-# Setup Phonon support - we only need this if we don't have or want KDE4
-if(NOT HAVE_KDE)
- if(WITH_PHONON)
- find_package(Phonon)
- if(PHONON_FOUND)
- message(STATUS "Enabling Phonon support")
- add_definitions(-DHAVE_PHONON)
- set(HAVE_PHONON true)
- else(PHONON_FOUND)
- message(STATUS "Phonon not found, disabling audio notifications")
- endif(PHONON_FOUND)
- else(WITH_PHONON)
- message(STATUS "Not enabling Phonon support")
- endif(WITH_PHONON)
-endif(NOT HAVE_KDE)
-
-# Setup libindicate-qt support
-if(WITH_LIBINDICATE)
- find_package(PkgConfig QUIET)
- if(PKG_CONFIG_FOUND)
- pkg_check_modules(INDICATEQT indicate-qt>=0.2.1)
- if(INDICATEQT_FOUND)
- message(STATUS "Enabling Ayatana notification support")
- set(HAVE_INDICATEQT true)
- add_definitions(-DHAVE_INDICATEQT)
- else(INDICATEQT_FOUND)
- message(STATUS "Disabling Ayatana notification support")
- endif(INDICATEQT_FOUND)
- endif(PKG_CONFIG_FOUND)
-else(WITH_LIBINDICATE)
- message(STATUS "Not enabling Ayatana notification support")
- # We don't want to link against it even if another package has found it
- set(INDICATEQT_LIBRARIES "")
-endif(WITH_LIBINDICATE)
-
-# Setup encyption support
-if(WITH_CRYPT)
- find_package(QCA2)
- if(QCA2_FOUND)
- message(STATUS "Found QCA2, enabling encryption support")
- add_definitions(-DHAVE_QCA2)
- set(LINK_QCA2 QCA2)
- set(HAVE_QCA2 true)
- set(MOC_DEFINES ${MOC_DEFINES} -DHAVE_QCA2)
- else(QCA2_FOUND)
- message(STATUS "QCA2 not found, disabling encryption support")
- endif(QCA2_FOUND)
-else(WITH_CRYPT)
- message(STATUS "Not enabling encryption support")
-endif(WITH_CRYPT)
-
# Now set up install locations; those are set by KDE if integration is enabled
if(NOT HAVE_KDE)
if(WIN32)
--- /dev/null
+# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... )
+# This macro is intended to be used in FindXXX.cmake modules files.
+# It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and
+# it also sets the <UPPERCASED_NAME>_FOUND variable.
+# The package is considered found if all variables listed are TRUE.
+# The version-argument of FIND_PACKAGE() is also handled.
+# For checking whether the version is ok, this macro compares the
+# variable <UPPERCASED_NAME>_VERSION with the specified version.
+# Example:
+#
+# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
+#
+# LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and
+# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
+# If it is not found and REQUIRED was used, it fails with FATAL_ERROR,
+# independent whether QUIET was used or not.
+# If it is found, the location is reported using the VAR1 argument, so
+# here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out.
+# If the second argument is DEFAULT_MSG, the message in the failure case will
+# be "Could NOT find LibXml2", if you don't like this message you can specify
+# your own custom failure message there.
+
+#=============================================================================
+# Copyright 2007-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distributed this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+INCLUDE(FindPackageMessage)
+FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 )
+
+ IF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
+ SET(_FAIL_MESSAGE "Could NOT find ${_NAME}")
+ ELSE("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
+ SET(_FAIL_MESSAGE "${_FAIL_MSG}")
+ ENDIF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
+
+ STRING(TOUPPER ${_NAME} _NAME_UPPER)
+
+ # collect all variables which were not found, so they can be printed, so the
+ # user knows better what went wrong (#6375)
+ SET(MISSING_VARS "")
+ SET(DETAILS "")
+ SET(${_NAME_UPPER}_FOUND TRUE)
+ IF(NOT ${_VAR1})
+ SET(${_NAME_UPPER}_FOUND FALSE)
+ SET(MISSING_VARS " ${_VAR1}")
+ ELSE(NOT ${_VAR1})
+ SET(DETAILS "${DETAILS}[${${_VAR1}}]")
+ ENDIF(NOT ${_VAR1})
+
+ # check if all passed variables are valid
+ FOREACH(_CURRENT_VAR ${ARGN})
+ IF(NOT ${_CURRENT_VAR})
+ SET(${_NAME_UPPER}_FOUND FALSE)
+ SET(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}")
+ ELSE(NOT ${_CURRENT_VAR})
+ SET(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]")
+ ENDIF(NOT ${_CURRENT_VAR})
+ ENDFOREACH(_CURRENT_VAR)
+
+ # version handling:
+ SET(VERSION_MSG "")
+ SET(VERSION_OK TRUE)
+ IF (${_NAME}_FIND_VERSION)
+
+ # if the package was found, check for the version using <NAME>_FIND_VERSION
+ IF (${_NAME_UPPER}_FOUND)
+ IF(${_NAME_UPPER}_VERSION)
+ SET(VERSION ${${_NAME_UPPER}_VERSION})
+ ELSEIF(${_NAME}_VERSION)
+ SET(VERSION ${${_NAME}_VERSION})
+ ENDIF(${_NAME_UPPER}_VERSION)
+
+ IF(VERSION) #hmm what do we do if the module in question doesn't set FOO_VERSION but something else ?... Ignore it for now
+
+ IF(${_NAME}_FIND_VERSION_EXACT) # exact version required
+ IF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
+ SET(VERSION_MSG " Found version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
+ SET(VERSION_OK FALSE)
+ ELSE (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
+ SET(VERSION_MSG " (found exact version \"${VERSION}\")")
+ ENDIF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
+
+ ELSE(${_NAME}_FIND_VERSION_EXACT) # minimum version specified:
+ IF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
+ SET(VERSION_MSG " Found version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"")
+ SET(VERSION_OK FALSE)
+ ELSE ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
+ SET(VERSION_MSG " (found version \"${VERSION}\", required is \"${${_NAME}_FIND_VERSION}\")")
+ ENDIF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
+ ENDIF(${_NAME}_FIND_VERSION_EXACT)
+
+ ELSE(VERSION)
+ SET(VERSION_MSG " (WARNING: Required version is \"${${_NAME}_FIND_VERSION}\", but version of ${_NAME} is unknown)")
+ ENDIF(VERSION)
+
+ # if the package was not found, but some a version was given, add that to the output:
+ ELSE (${_NAME_UPPER}_FOUND)
+ IF(${_NAME}_FIND_VERSION_EXACT)
+ SET(VERSION_MSG " (Required is exact version \"${${_NAME}_FIND_VERSION}\")")
+ ELSE(${_NAME}_FIND_VERSION_EXACT)
+ SET(VERSION_MSG " (Required is at least version \"${${_NAME}_FIND_VERSION}\")")
+ ENDIF(${_NAME}_FIND_VERSION_EXACT)
+ ENDIF (${_NAME_UPPER}_FOUND)
+ ENDIF (${_NAME}_FIND_VERSION)
+
+ IF(VERSION_OK)
+ SET(DETAILS "${DETAILS}[v${${VERSION}}]")
+ ELSE(VERSION_OK)
+ SET(${_NAME_UPPER}_FOUND FALSE)
+ ENDIF(VERSION_OK)
+
+
+ # print the result:
+ IF (${_NAME_UPPER}_FOUND)
+ FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_VAR1}} ${VERSION_MSG}" "${DETAILS}")
+ ELSE (${_NAME_UPPER}_FOUND)
+ IF(NOT VERSION_OK)
+
+ IF (${_NAME}_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_VAR1}})")
+ ELSE (${_NAME}_FIND_REQUIRED)
+ IF (NOT ${_NAME}_FIND_QUIETLY)
+ MESSAGE(STATUS "${_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_VAR1}})")
+ ENDIF (NOT ${_NAME}_FIND_QUIETLY)
+ ENDIF (${_NAME}_FIND_REQUIRED)
+
+ ELSE(NOT VERSION_OK)
+
+ IF (${_NAME}_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}")
+ ELSE (${_NAME}_FIND_REQUIRED)
+ IF (NOT ${_NAME}_FIND_QUIETLY)
+ MESSAGE(STATUS "${_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}")
+ ENDIF (NOT ${_NAME}_FIND_QUIETLY)
+ ENDIF (${_NAME}_FIND_REQUIRED)
+ ENDIF(NOT VERSION_OK)
+
+ ENDIF (${_NAME_UPPER}_FOUND)
+
+ SET(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE)
+
+ENDFUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
--- /dev/null
+# - 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] [QUIET] <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 status messages will be printed.
+#
+# 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 )
+
+ if (NOT ${_is_silent})
+ message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")
+ endif (NOT ${_is_silent})
+ 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})
+
+ if (NOT ${_pkg_is_silent})
+ message(STATUS "checking for one of the modules '${_pkg_modules_alt}'")
+ endif (NOT ${_pkg_is_silent})
+
+ # 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: