One last test for the CIA bot:
[quassel.git] / CMakeLists.txt
1 PROJECT(Quassel)
2
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)
5
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.")
8 SET(BUILD_CORE )
9 SET(BUILD_GUI )
10 SET(BUILD_MONO )
11 IF(BUILD MATCHES "core" OR BUILD MATCHES "all")
12   SET(BUILD_CORE true)
13   MESSAGE("Building Quassel core.")
14 ENDIF(BUILD MATCHES "core" OR BUILD MATCHES "all")
15 IF(BUILD MATCHES "gui" OR BUILD MATCHES "all")
16   SET(BUILD_GUI true)
17   MESSAGE("Building Quassel GUI.")
18 ENDIF(BUILD MATCHES "gui" OR BUILD MATCHES "all")
19 IF(BUILD MATCHES "mono" OR BUILD MATCHES "all")
20   SET(BUILD_MONO true)
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)
26
27 SET(CMAKE_BUILD_TYPE Debug)
28
29 # Define files
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)
35
36 # Build correct absolute paths for subdirs to include
37 SET(SDIRS "")
38 FOREACH(dir ${quassel_DIRS})
39   SET(SDIRS ${SDIRS} "${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
40 ENDFOREACH(dir)
41 INCLUDE_DIRECTORIES(${SDIRS} plugins)
42 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
43
44 # We need Qt4 support.
45 SET(QT_MIN_VERSION "4.3.0")
46 FIND_PACKAGE(Qt4 REQUIRED)
47
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})
54
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.
57
58 ADD_SUBDIRECTORY(main)
59 IF(BUILD_CORE)
60   ADD_SUBDIRECTORY(core)
61 ENDIF(BUILD_CORE)
62 IF(BUILD_MONO AND NOT BUILD_CORE)
63   ADD_SUBDIRECTORY(core)
64 ENDIF(BUILD_MONO AND NOT BUILD_CORE)
65
66 QT4_ADD_RESOURCES(_RCCS ${quassel_RCCS})
67
68 IF(BUILD_CORE)
69   ADD_DEFINITIONS(-DBUILD_CORE)
70   ADD_EXECUTABLE(quasselcore ${quassel_core_SRCS} ${_RCCS})
71   TARGET_LINK_LIBRARIES(quasselcore core main ${QT_LIBRARIES})
72 ENDIF(BUILD_CORE)
73
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 "")
78   SET(QT_LIBRARIES "")
79   INCLUDE(${QT_USE_FILE})
80   ADD_SUBDIRECTORY(gui)
81
82   IF(BUILD_MONO)
83     ADD_DEFINITIONS(-DBUILD_MONO)
84     ADD_EXECUTABLE(quassel ${quassel_mono_SRCS} ${_RCCS})
85     TARGET_LINK_LIBRARIES(quassel gui core main ${QT_LIBRARIES})
86   ENDIF(BUILD_MONO)
87
88   IF(BUILD_GUI)
89     ADD_DEFINITIONS(-DBUILD_GUI)
90     ADD_EXECUTABLE(quasselgui ${quassel_gui_SRCS} ${_RCCS})
91     TARGET_LINK_LIBRARIES(quasselgui gui main ${QT_LIBRARIES})
92   ENDIF(BUILD_GUI)
93
94 ENDIF(BUILD_GUI OR BUILD_MONO)