3 # 2.4.2 had a bug with out-of-source builds and UIC dependencies.
4 CMAKE_MINIMUM_REQUIRED(VERSION 2.4.3 FATAL_ERROR)
6 # Select if Quassel should be built in client, server or monolithic mode
7 SET(BUILD "mono" CACHE STRING "Defines which Quassel parts are to be built. Can contain 'core', 'gui' and/or 'monolithic' (which is the default), or 'all' to build everything.")
11 IF(BUILD MATCHES "core" OR BUILD MATCHES "all")
13 MESSAGE("Building Quassel core.")
14 ENDIF(BUILD MATCHES "core" OR BUILD MATCHES "all")
15 IF(BUILD MATCHES "gui" OR BUILD MATCHES "all")
17 MESSAGE("Building Quassel GUI.")
18 ENDIF(BUILD MATCHES "gui" OR BUILD MATCHES "all")
19 IF(BUILD MATCHES "mono" OR BUILD MATCHES "all")
21 MESSAGE("Building monolithic Quassel.")
22 ENDIF(BUILD MATCHES "mono" OR BUILD MATCHES "all")
23 IF(NOT BUILD_MONO AND NOT BUILD_CORE AND NOT BUILD_GUI)
24 MESSAGE(FATAL_ERROR "\nYou have not selected which parts of Quassel I should build. Aborting.\nRun 'cmake <path> -DBUILD=<part>', where <part> contains one or more of 'core', 'gui' or 'monolithic', or 'all' to build everything.\n")
25 ENDIF(NOT BUILD_MONO AND NOT BUILD_CORE AND NOT BUILD_GUI)
27 SET(CMAKE_BUILD_TYPE Debug)
30 SET(quassel_mono_SRCS main/main_mono.cpp)
31 SET(quassel_core_SRCS main/main_core.cpp)
32 SET(quassel_gui_SRCS main/main_gui.cpp ${common_SRCS})
33 SET(quassel_RCCS images/icons.qrc)
34 SET(quassel_DIRS main gui core)
36 # Build correct absolute paths for subdirs to include
38 FOREACH(dir ${quassel_DIRS})
39 SET(SDIRS ${SDIRS} "${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
41 INCLUDE_DIRECTORIES(${SDIRS} plugins)
42 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
44 # We need Qt4 support.
45 SET(QT_MIN_VERSION "4.3.0")
46 FIND_PACKAGE(Qt4 REQUIRED)
48 # Set needed libraries
49 SET(QT_USE_QTXML true)
50 SET(QT_USE_QTSQL true)
51 SET(QT_USE_QTNETWORK true)
52 SET(QT_DONT_USE_QTGUI true) # This is added later if GUI is requested
53 INCLUDE(${QT_USE_FILE})
55 # Define subdirs. CMake complains if a directory is added twice, so make sure this
56 # does not happen in any combination of the requested targets.
58 ADD_SUBDIRECTORY(main)
60 ADD_SUBDIRECTORY(core)
62 IF(BUILD_MONO AND NOT BUILD_CORE)
63 ADD_SUBDIRECTORY(core)
64 ENDIF(BUILD_MONO AND NOT BUILD_CORE)
66 QT4_ADD_RESOURCES(_RCCS ${quassel_RCCS})
69 ADD_DEFINITIONS(-DBUILD_CORE)
70 ADD_EXECUTABLE(quasselcore ${quassel_core_SRCS} ${_RCCS})
71 TARGET_LINK_LIBRARIES(quasselcore core main ${QT_LIBRARIES})
74 IF(BUILD_GUI OR BUILD_MONO) # OK, now we need QtGui!
75 REMOVE_DEFINITIONS(-DQT_CORE_LIB -DQT_GUI_LIB ${QT_DEFINITIONS})
76 SET(QT_DONT_USE_QTGUI "")
77 SET(QT_INCLUDE_DIR "")
79 INCLUDE(${QT_USE_FILE})
83 ADD_DEFINITIONS(-DBUILD_MONO)
84 ADD_EXECUTABLE(quassel ${quassel_mono_SRCS} ${_RCCS})
85 TARGET_LINK_LIBRARIES(quassel gui core main ${QT_LIBRARIES})
89 ADD_DEFINITIONS(-DBUILD_GUI)
90 ADD_EXECUTABLE(quasselgui ${quassel_gui_SRCS} ${_RCCS})
91 TARGET_LINK_LIBRARIES(quasselgui gui main ${QT_LIBRARIES})
94 ENDIF(BUILD_GUI OR BUILD_MONO)