X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=CMakeLists.txt;h=5a365e5e9043023965d5055cefc90484b5f20502;hp=959790e98ca79df913a00f7006ac2a544222602d;hb=bb0bf17b61958e92529338596574f7a2a4f61d2a;hpb=8b192b08f3df4ce0e7cc4a08564645c76efa688d diff --git a/CMakeLists.txt b/CMakeLists.txt index 959790e9..5a365e5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,57 +1,77 @@ PROJECT(Quassel) -# CMAKE_MINIMUM_REQUIRED(VERSION 2.4.2) +# 2.4.2 had a bug with out-of-source builds and UIC dependencies. +CMAKE_MINIMUM_REQUIRED(VERSION 2.4.3 FATAL_ERROR) # Select if Quassel should be built in client, server or monolithic mode -SET(BUILD "mono" CACHE STRING "Defines which Quassel parts are to be built. Can contain 'core', 'gui' and/or 'monolithic' (which is the default).") +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.") SET(BUILD_CORE ) SET(BUILD_GUI ) SET(BUILD_MONO ) -IF(BUILD MATCHES "core") +IF(BUILD MATCHES "core" OR BUILD MATCHES "all") SET(BUILD_CORE true) - MESSAGE(STATUS "Building Quassel core.") -ENDIF(BUILD MATCHES "core") -IF(BUILD MATCHES "gui") + MESSAGE("Building Quassel core.") +ENDIF(BUILD MATCHES "core" OR BUILD MATCHES "all") +IF(BUILD MATCHES "gui" OR BUILD MATCHES "all") SET(BUILD_GUI true) - MESSAGE(STATUS "Building Quassel GUI.") -ENDIF(BUILD MATCHES "gui") -IF(BUILD MATCHES "mono") + MESSAGE("Building Quassel GUI.") +ENDIF(BUILD MATCHES "gui" OR BUILD MATCHES "all") +IF(BUILD MATCHES "mono" OR BUILD MATCHES "all") SET(BUILD_MONO true) - MESSAGE(STATUS "Building monolithic Quassel.") -ENDIF(BUILD MATCHES "mono") + MESSAGE("Building monolithic Quassel.") +ENDIF(BUILD MATCHES "mono" OR BUILD MATCHES "all") IF(NOT BUILD_MONO AND NOT BUILD_CORE AND NOT BUILD_GUI) - MESSAGE(FATAL_ERROR "You have not selected which parts of Quassel I should build. Aborting.\nRun 'cmake -DBUILD=', where contains one or more of 'core', 'gui' or 'monolithic'.") + MESSAGE(FATAL_ERROR "\nYou have not selected which parts of Quassel I should build. Aborting.\nRun 'cmake -DBUILD=', where contains one or more of 'core', 'gui' or 'monolithic', or 'all' to build everything.\n") ENDIF(NOT BUILD_MONO AND NOT BUILD_CORE AND NOT BUILD_GUI) +SET(CMAKE_BUILD_TYPE Debug) + # Define files SET(quassel_mono_SRCS main/main_mono.cpp) SET(quassel_core_SRCS main/main_core.cpp) +SET(quassel_gui_SRCS main/main_gui.cpp ${common_SRCS}) SET(quassel_RCCS images/icons.qrc) -SET(quassel_DIRS gui core network) +SET(quassel_DIRS main gui core) # Build correct absolute paths for subdirs to include SET(SDIRS "") FOREACH(dir ${quassel_DIRS}) SET(SDIRS ${SDIRS} "${CMAKE_CURRENT_SOURCE_DIR}/${dir}") ENDFOREACH(dir) -INCLUDE_DIRECTORIES(${SDIRS}) +INCLUDE_DIRECTORIES(${SDIRS} plugins) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) # We need Qt4 support. +SET(QT_MIN_VERSION "4.3.0") # 4.3 is required for SSL, crypto and some other stuff FIND_PACKAGE(Qt4 REQUIRED) # Set needed libraries SET(QT_USE_QTXML true) +SET(QT_USE_QTSQL true) SET(QT_USE_QTNETWORK true) SET(QT_DONT_USE_QTGUI true) # This is added later if GUI is requested INCLUDE(${QT_USE_FILE}) -ADD_SUBDIRECTORY(network) -ADD_SUBDIRECTORY(core) +# Define subdirs. CMake complains if a directory is added twice, so make sure this +# does not happen in any combination of the requested targets. + +ADD_SUBDIRECTORY(main) +IF(BUILD_CORE) + ADD_SUBDIRECTORY(core) +ENDIF(BUILD_CORE) +IF(BUILD_MONO AND NOT BUILD_CORE) + ADD_SUBDIRECTORY(core) +ENDIF(BUILD_MONO AND NOT BUILD_CORE) + QT4_ADD_RESOURCES(_RCCS ${quassel_RCCS}) +SET(TARGET_LIST ) + IF(BUILD_CORE) + ADD_DEFINITIONS(-DBUILD_CORE) ADD_EXECUTABLE(quasselcore ${quassel_core_SRCS} ${_RCCS}) - TARGET_LINK_LIBRARIES(quasselcore core network ${QT_LIBRARIES}) + TARGET_LINK_LIBRARIES(quasselcore core main ${QT_LIBRARIES}) + SET(TARGET_LIST ${TARGET_LIST} quasselcore) ENDIF(BUILD_CORE) IF(BUILD_GUI OR BUILD_MONO) # OK, now we need QtGui! @@ -60,16 +80,25 @@ IF(BUILD_GUI OR BUILD_MONO) # OK, now we need QtGui! SET(QT_INCLUDE_DIR "") SET(QT_LIBRARIES "") INCLUDE(${QT_USE_FILE}) + ADD_SUBDIRECTORY(gui) IF(BUILD_MONO) - ADD_SUBDIRECTORY(gui) + ADD_DEFINITIONS(-DBUILD_MONO) ADD_EXECUTABLE(quassel ${quassel_mono_SRCS} ${_RCCS}) - TARGET_LINK_LIBRARIES(quassel gui core network ${QT_LIBRARIES}) + TARGET_LINK_LIBRARIES(quassel gui core main ${QT_LIBRARIES}) + SET(TARGET_LIST ${TARGET_LIST} quassel) ENDIF(BUILD_MONO) IF(BUILD_GUI) - ADD_SUBDIRECTORY(gui) - MESSAGE(FATAL_ERROR "Client mode not yet supported.") + ADD_DEFINITIONS(-DBUILD_GUI) + ADD_EXECUTABLE(quasselgui ${quassel_gui_SRCS} ${_RCCS}) + TARGET_LINK_LIBRARIES(quasselgui gui main ${QT_LIBRARIES}) + SET(TARGET_LIST ${TARGET_LIST} quasselgui) ENDIF(BUILD_GUI) ENDIF(BUILD_GUI OR BUILD_MONO) + +INSTALL(TARGETS ${TARGET_LIST} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib/static)