+# cmake 2.6.2 is required for KDE >=4.2 and should be widespread enough now
+cmake_minimum_required(VERSION 2.6.2 FATAL_ERROR)
+
+if(COMMAND cmake_policy)
+ cmake_policy(SET CMP0003 NEW)
+endif(COMMAND cmake_policy)
+
+# Use our own (well, and KDE's) version of some modules
+# In particular cmake's own FindQt4 and FindOpenSSL are quite buggy
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
+include(QuasselMacros)
+
+# Various options and variables that can be set on the command line
+option(WANT_CORE "Build the core (server) binary" ON)
+option(WANT_QTCLIENT "Build the Qt4 GUI client binary" ON)
+option(WANT_MONO "Build the monolithic (all-in-one) binary" ON)
+
+option(WITH_OPENSSL "Enable OpenSSL support if present on the system" ON)
+option(WITH_DBUS "Enable D-Bus support if present on the system" ON)
+option(WITH_WEBKIT "Enable WebKit support (for link previews)" ON)
+option(WITH_PHONON "Enable Phonon support (for audio notifications)" ON)
+option(WITH_LIBINDICATE "Enable Ayatana notification support" ON)
+option(WITH_KDE "Enable KDE4 integration" OFF)
+
+# We use icon paths from KDE 4.3.x, which are partially invalid on older and possibly
+# even on newer KDE versions. Do not disable this unless you are sure that your Quassel will
+# run on a matching KDE version only.
+set(WITH_OXYGEN AUTO CACHE STRING "Install Oxygen icons (default is \"AUTO\" to install when KDE 4.3 or later is present")
+
+option(STATIC "Enable static building (might not be portable)" OFF)
+
+if(APPLE)
+ option(DEPLOY "Mac OS X only! Adds required libs to bundle resources and create a dmg. Note: requires Qt to be built with 10.4u SDK" OFF)
+endif(APPLE)
+
+# Default to embedding data in the static case
+if(STATIC OR WIN32)
+ set(EMBED_DEFAULT ON)
+else(STATIC OR WIN32)
+ set(EMBED_DEFAULT ON) # should be OFF as soon as everything works
+endif(STATIC OR WIN32)
+
+option(EMBED_DATA "Embed all data files in the binary (rather than installing them separately)" ${EMBED_DEFAULT})
+
+set(QT "" CACHE STRING "Path to a Qt installation to use instead of the system Qt (e.g. for static builds)")
+
+# Some settings imply others
+if(STATIC)
+ add_definitions(-DSTATIC)
+ set(WITH_KDE OFF CACHE BOOL "Static building with KDE is not supported")
+endif(STATIC)
+
+if(WIN32)
+ # We don't support separately installed resources yet on Win32
+ set(EMBED_DATA ON)
+endif(WIN32)
+
+# For static builds, arbitrary extra libs might need to be linked
+# Define a comma-separated list here
+# e.g. for pgsql, we need -DLINK_EXTRA=pq;crypt
+set(LINK_EXTRA "" CACHE STRING "Semicolon-separated list of libraries to be linked")
+if(LINK_EXTRA)
+ string(REPLACE "," ";" LINK_EXTRA ${LINK_EXTRA})
+ link_libraries(${LINK_EXTRA})
+endif(LINK_EXTRA)
+
+# Build Type
+# We need to make sure it's not empty
+# Supported: Release, RelWithDebugInfo, Debug, Debugfull