-cmake_minimum_required(VERSION 2.4.5)
-
-set(QT_MIN_VERSION "4.4.0")
-
-# By default, we build all binaries
-if(NOT DEFINED BUILD)
- set(BUILD all)
-endif(NOT DEFINED BUILD)
-
-# User might define which binaries to build by invoking cmake -DBUILD=<string>,
-# where <string> might contain any combination of "core", "client", "mono" or "all"
-if(BUILD MATCHES all)
- set(BUILD_CORE true)
- set(BUILD_QTCLIENT true)
- set(BUILD_MONO true)
- message(STATUS "Building Quassel Client, Quassel Core and monolithic Quassel.")
-else(BUILD MATCHES all)
- if(BUILD MATCHES core)
- set(BUILD_CORE true)
- message(STATUS "Building Quassel Core")
- endif(BUILD MATCHES core)
- if(BUILD MATCHES client)
- set(BUILD_QTCLIENT true)
- message(STATUS "Building Quassel Client")
- endif(BUILD MATCHES client)
- if(BUILD MATCHES mono)
- set(BUILD_MONO true)
- message(STATUS "Building monolithic Quassel")
- endif(BUILD MATCHES mono)
-endif(BUILD MATCHES all)
+# Target scopes don't work in older versions
+cmake_minimum_required(VERSION 2.4.7 FATAL_ERROR)
+
+# This would suppress annoying warnings on cmake-2.6, but we can't use it
+# with 2.4, so... DUH!
+# cmake_policy(SET CMP0003 OLD) # suppress linker warnings
+
+if(STATICWIN)
+ set(CMAKE_BUILD_TYPE Release)
+endif(STATICWIN)
+
+# Enable various flags on gcc
+include(CheckCXXCompilerFlag)
+check_cxx_compiler_flag(-Wall Wall)
+if(Wall)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+endif(Wall)
+check_cxx_compiler_flag(-Wextra Wextra)
+if(Wextra)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
+endif(Wextra)
+check_cxx_compiler_flag(-ansi ansi)
+if(ansi)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi")
+endif(ansi)
+
+set(QT_MIN_VERSION "4.3.0")
+
+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)
+
+# Enable mostly b0rked stuff (new ChatView), do not enable this unless you know what you do...
+if(SPUTDEV)
+ add_definitions(-DSPUTDEV)
+endif(SPUTDEV)
+
+# Set up OpenSSL
+find_package(OpenSSL)