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 IF(BUILD_CORE OR BUILD_GUI)
28 MESSAGE(FATAL_ERROR "\nBuilding of standalone core or GUI not supported at this time. Please check back later.\n")
29 ENDIF(BUILD_CORE OR BUILD_GUI)
31 SET(CMAKE_BUILD_TYPE Debug)
34 SET(quassel_mono_SRCS common/main_mono.cpp)
35 SET(quassel_core_SRCS common/main_core.cpp)
36 SET(quassel_gui_SRCS common/main_gui.cpp ${common_SRCS})
37 SET(quassel_RCCS images/icons.qrc)
38 SET(quassel_DIRS common qtgui core)
40 # Build correct absolute paths for subdirs to include
42 FOREACH(dir ${quassel_DIRS})
43 SET(SDIRS ${SDIRS} "${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
45 INCLUDE_DIRECTORIES(${SDIRS} client plugins)
46 #INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
48 # We need Qt4 support.
49 SET(QT_MIN_VERSION "4.3.0") # 4.3 is required for SSL, crypto and some other stuff
50 FIND_PACKAGE(Qt4 REQUIRED)
52 # Set needed libraries
53 SET(QT_USE_QTXML true)
54 SET(QT_USE_QTSQL true)
55 SET(QT_USE_QTNETWORK true)
56 SET(QT_DONT_USE_QTGUI true) # This is added later if GUI is requested
57 INCLUDE(${QT_USE_FILE})
59 # Define subdirs. CMake complains if a directory is added twice, so make sure this
60 # does not happen in any combination of the requested targets.
62 ADD_SUBDIRECTORY(common)
64 ADD_SUBDIRECTORY(core)
66 IF(BUILD_MONO AND NOT BUILD_CORE)
67 ADD_SUBDIRECTORY(core)
68 ENDIF(BUILD_MONO AND NOT BUILD_CORE)
70 QT4_ADD_RESOURCES(_RCCS ${quassel_RCCS})
75 ADD_DEFINITIONS(-DBUILD_CORE)
76 ADD_EXECUTABLE(quasselcore ${quassel_core_SRCS} ${_RCCS})
77 TARGET_LINK_LIBRARIES(quasselcore core common ${QT_LIBRARIES})
78 SET(TARGET_LIST ${TARGET_LIST} quasselcore)
81 IF(BUILD_GUI OR BUILD_MONO) # OK, now we need QtGui!
82 REMOVE_DEFINITIONS(-DQT_CORE_LIB -DQT_GUI_LIB ${QT_DEFINITIONS})
83 SET(QT_DONT_USE_QTGUI "")
84 SET(QT_INCLUDE_DIR "")
86 INCLUDE(${QT_USE_FILE})
87 ADD_SUBDIRECTORY(qtgui)
90 ADD_DEFINITIONS(-DBUILD_MONO)
91 ADD_EXECUTABLE(quassel ${quassel_mono_SRCS} ${_RCCS})
92 TARGET_LINK_LIBRARIES(quassel qtgui core common ${QT_LIBRARIES})
93 SET(TARGET_LIST ${TARGET_LIST} quassel)
97 ADD_DEFINITIONS(-DBUILD_GUI)
98 ADD_EXECUTABLE(quasselgui ${quassel_gui_SRCS} ${_RCCS})
99 TARGET_LINK_LIBRARIES(quasselgui qtgui common ${QT_LIBRARIES})
100 SET(TARGET_LIST ${TARGET_LIST} quasselgui)
103 ENDIF(BUILD_GUI OR BUILD_MONO)
105 INSTALL(TARGETS ${TARGET_LIST}
106 RUNTIME DESTINATION bin
107 LIBRARY DESTINATION lib
108 ARCHIVE DESTINATION lib/static)