# Set up project
project(Quassel CXX)
-# General conveniences
+# Let CMake handle file generation for Qt
set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+# Needed, otherwise some .moc files won't be found with older CMake versions
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Include various CMake modules...
# Setup CMake
#####################################################################
-# Setting COMPILE_DEFINITIONS_<CONFIG> is deprecated since CMake 3.0 in favor of generator expressions.
-# These have existed since CMake 2.8.10; until we depend on that, we have to explicitly enable the old policy.
-if (POLICY CMP0043)
- cmake_policy(SET CMP0043 OLD)
-endif()
-
-# Honor visibility settings for all target types
-if (POLICY CMP0063)
- cmake_policy(SET CMP0063 NEW)
-endif()
-
-# Don't automoc generated files
+# Let automoc/autouic process generated files
if (POLICY CMP0071)
- cmake_policy(SET CMP0071 OLD)
+ cmake_policy(SET CMP0071 NEW)
endif()
-
# Simplify later checks
#####################################################################
find_package(Ldap)
if (LDAP_FOUND)
message(STATUS "Enabling LDAP authentication support")
- set(HAVE_LDAP true)
- add_definitions(-DHAVE_LDAP)
else()
message(STATUS "Disabling LDAP authentication support")
endif()
# Prepare the build
#####################################################################
-# These variables will be added to the main targets (CORE, QTCLIENT, MONO)
-set(COMMON_DEPS ${RC_WIN32})
-set(CORE_DEPS )
-set(CLIENT_DEPS )
-
# Add needed subdirs - the order is important, since src needs some vars set by other dirs
add_subdirectory(data)
add_subdirectory(icons)
include(CheckCXXCompilerFlag)
-# Qt debug flags
-set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG QT_DEBUG)
-set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG NDEBUG)
-set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG NDEBUG)
-set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG NDEBUG)
-
-if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
- set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_DEBUG NDEBUG)
-endif()
-
# Enable various flags on gcc
if (CMAKE_COMPILER_IS_GNUCXX)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8")
if (NOT DEFINED CMAKE_INSTALL_BINDIR)
set(CMAKE_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Install path for binaries")
endif()
+ if (NOT DEFINED CMAKE_INSTALL_LIBDIR)
+ set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Install path for libraries")
+ endif()
if (NOT DEFINED CMAKE_INSTALL_DATADIR)
set(CMAKE_INSTALL_DATADIR "$ENV{APPDATA}/quassel-irc.org/share/apps" CACHE PATH "Install path for data files")
endif()
-# This file contains various macros useful for building Quassel.
+# This file contains various functions and macros useful for building Quassel.
#
-# (C) 2014 by the Quassel Project <devel@quassel-irc.org>
-#
-# The qt5_use_modules function was taken from Qt 5.10.1 (and modified):
-# (C) 2005-2011 Kitware, Inc.
+# (C) 2014-2018 by the Quassel Project <devel@quassel-irc.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+###################################################################################################
+
+###################################################################################################
+# Adds a library target for a Quassel module.
+#
+# It expects the (CamelCased) module name as a parameter, and derives various
+# strings from it. For example, quassel_add_module(Client) produces
+# - a library target named quassel_client with output name (lib)quassel-client(.so)
+# - an alias target named Quassel::Client in global scope
+#
+# The function exports the TARGET variable which can be used in the current scope
+# for setting source files, properties, link dependencies and so on.
+# To refer to the target outside of the current scope, e.g. for linking, use
+# the alias name.
+#
+function(quassel_add_module _module)
+ # Derive target, alias target, output name from the given module name
+ set(alias "Quassel::${_module}")
+ set(target ${alias})
+ string(TOLOWER ${target} target)
+ string(REPLACE "::" "_" target ${target})
+ string(REPLACE "_" "-" output_name ${target})
+
+ add_library(${target} STATIC "")
+ add_library(${alias} ALIAS ${target})
-############################
-# Macros for dealing with Qt
-############################
+ set_target_properties(${target} PROPERTIES
+ OUTPUT_NAME ${output_name}
+ )
-# Qt 5.11 removed the qt5_use_modules function, so we need to provide it until we can switch to a modern CMake version.
-# If present, the Qt-provided version will be used automatically instead.
-function(qt5_use_modules _target _link_type)
- if (NOT TARGET ${_target})
- message(FATAL_ERROR "The first argument to qt5_use_modules must be an existing target.")
- endif()
- if ("${_link_type}" STREQUAL "LINK_PUBLIC" OR "${_link_type}" STREQUAL "LINK_PRIVATE" )
- set(_qt5_modules ${ARGN})
- set(_qt5_link_type ${_link_type})
- else()
- set(_qt5_modules ${_link_type} ${ARGN})
- endif()
+ target_include_directories(${target}
+ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+ PRIVATE ${CMAKE_CURRENT_BINARY_DIR} # for generated files
+ )
- if ("${_qt5_modules}" STREQUAL "")
- message(FATAL_ERROR "qt5_use_modules requires at least one Qt module to use.")
- endif()
- foreach(_module ${_qt5_modules})
- if (NOT Qt5${_module}_FOUND)
- find_package(Qt5${_module} PATHS "${_Qt5_COMPONENT_PATH}" NO_DEFAULT_PATH)
- if (NOT Qt5${_module}_FOUND)
- message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.")
- endif()
- endif()
- target_link_libraries(${_target} ${_qt5_link_type} ${Qt5${_module}_LIBRARIES})
- set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Qt5${_module}_INCLUDE_DIRS})
- set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${Qt5${_module}_COMPILE_DEFINITIONS})
- if (Qt5_POSITION_INDEPENDENT_CODE
- AND (CMAKE_VERSION VERSION_LESS 2.8.12
- AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
- OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)))
- set_property(TARGET ${_target} PROPERTY POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE})
- endif()
- endforeach()
+ # Export the target name for further use
+ set(TARGET ${target} PARENT_SCOPE)
endfunction()
######################################
-# Builds the three main targets
-
add_subdirectory(common)
-include_directories(BEFORE common)
-if(BUILD_CORE)
- add_subdirectory(core)
- include_directories(BEFORE core)
-endif()
-if(BUILD_GUI)
- add_subdirectory(client)
- add_subdirectory(uisupport)
- add_subdirectory(qtui)
- include_directories(BEFORE client)
- include_directories(BEFORE uisupport)
- include_directories(BEFORE qtui)
-endif()
-
-include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) # for version.gen
-
-# We need to initialize the appropriate resources, so let's give our main.cpp some hints
-if (EMBED_DATA)
- add_definitions(-DEMBED_DATA)
-endif()
-
-# For KAboutData
-if (WITH_KF5)
- set(CLIENT_LIBRARIES ${CLIENT_LIBRARIES} KF5::CoreAddons)
-endif()
-
-# Needed for showing the cli option if appropriate
-if (HAVE_SYSLOG)
- add_definitions(-DHAVE_SYSLOG)
-endif()
-
-if(WANT_CORE)
- add_executable(quasselcore common/main.cpp ${CORE_DEPS} ${COMMON_DEPS})
- qt5_use_modules(quasselcore Core Network ${CORE_QT_MODULES})
- add_dependencies(quasselcore po)
- set_target_properties(quasselcore PROPERTIES
- COMPILE_FLAGS "-DBUILD_CORE"
- RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
- target_link_libraries(quasselcore mod_core mod_common ${COMMON_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${QT_QTMAIN_LIBRARY})
- install(TARGETS quasselcore RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
-endif()
-
-if(WANT_QTCLIENT)
- add_executable(quasselclient WIN32 common/main.cpp ${CLIENT_DEPS} ${COMMON_DEPS})
- qt5_use_modules(quasselclient Core Gui Network ${CLIENT_QT_MODULES})
- add_dependencies(quasselclient po)
- set_target_properties(quasselclient PROPERTIES
- COMPILE_FLAGS "-DBUILD_QTUI"
- RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
- target_link_libraries(quasselclient mod_qtui mod_uisupport mod_client mod_common ${COMMON_LIBRARIES} ${CLIENT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${QT_QTMAIN_LIBRARY})
- install(TARGETS quasselclient RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
-endif()
-
-if(WANT_MONO)
- add_executable(quassel WIN32 common/main.cpp qtui/monoapplication.cpp ${CLIENT_DEPS} ${CORE_DEPS} ${COMMON_DEPS})
- qt5_use_modules(quassel Core Gui Network ${CLIENT_QT_MODULES} ${CORE_QT_MODULES})
- add_dependencies(quassel po)
- set_target_properties(quassel PROPERTIES
- COMPILE_FLAGS "-DBUILD_MONO"
- RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
- target_link_libraries(quassel mod_qtui mod_uisupport mod_client mod_core mod_common ${COMMON_LIBRARIES} ${CLIENT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${QT_QTMAIN_LIBRARY})
- install(TARGETS quassel RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
-endif()
-
-# Build bundles for MacOSX
-if(APPLE)
- add_custom_command(TARGET quasselclient POST_BUILD
- COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
- ${CMAKE_SOURCE_DIR} "Quassel Client" ../quasselclient)
- add_custom_command(TARGET quassel POST_BUILD
- COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
- ${CMAKE_SOURCE_DIR} "Quassel" ../quassel)
- if(DEPLOY)
- add_custom_command(TARGET quasselclient POST_BUILD
- COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Client .. qsvgicon)
- add_custom_command(TARGET quasselcore POST_BUILD
- COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Core ..)
- add_custom_command(TARGET quassel POST_BUILD
- COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Mono .. qsvgicon)
- endif()
+add_subdirectory(main)
+if (BUILD_CORE)
+ add_subdirectory(core)
+endif()
+if (BUILD_GUI)
+ add_subdirectory(client)
+ add_subdirectory(uisupport)
+ add_subdirectory(qtui)
endif()
-# Builds the client module
+quassel_add_module(Client)
-# We still have a minor dep to QtWidgets: QAbstractItemView in BufferModel
-
-set(SOURCES
+target_sources(${TARGET} PRIVATE
abstractmessageprocessor.cpp
backlogrequester.cpp
buffermodel.cpp
# needed for automoc
abstractui.h
-)
-
-qt5_add_resources(SOURCES ${CLIENT_RCS})
-add_library(mod_client STATIC ${SOURCES})
-qt5_use_modules(mod_client Network Core Gui Widgets)
+ ${CLIENT_RCS}
+)
-target_link_libraries(mod_client mod_common)
+target_link_libraries(${TARGET}
+ PUBLIC
+ Qt5::Core
+ Qt5::Gui
+ Qt5::Network
+ Qt5::Widgets # QAbstractItemView in BufferModel
+ Quassel::Common
+)
-# Builds the common module
+quassel_add_module(Common)
-set(SOURCES
+target_sources(${TARGET} PRIVATE
abstractsignalwatcher.h
aliasmanager.cpp
authhandler.cpp
# needed for automoc
irccap.h
protocol.h
-)
-if (HAVE_SYSLOG)
- add_definitions(-DHAVE_SYSLOG)
-endif()
+ ${COMMON_RCS}
+)
-if (APPLE)
- set(SOURCES ${SOURCES} mac_utils.cpp)
-endif()
+# Needed for finding the generated version.h
+target_include_directories(${TARGET} PRIVATE ${CMAKE_BINARY_DIR})
-qt5_add_resources(SOURCES ${COMMON_RCS})
+target_link_libraries(${TARGET} PUBLIC
+ ${CMAKE_DL_LIBS}
+ Qt5::Core
+ Qt5::Network
+ ZLIB::ZLIB
+)
-add_library(mod_common STATIC ${SOURCES})
-qt5_use_modules(mod_common Core Network)
+if (HAVE_SYSLOG)
+ target_compile_definitions(${TARGET} PRIVATE -DHAVE_SYSLOG)
+endif()
if (WIN32)
- target_sources(mod_common PRIVATE logbacktrace_win.cpp windowssignalwatcher.cpp)
+ target_sources(${TARGET} PRIVATE logbacktrace_win.cpp windowssignalwatcher.cpp)
else()
if (Backtrace_FOUND)
configure_file(backtrace_config.h.in backtrace_config.h)
- target_compile_definitions(mod_common PRIVATE -DHAVE_BACKTRACE)
- target_include_directories(mod_common PRIVATE ${Backtrace_INCLUDE_DIRS})
- target_link_libraries(mod_common PRIVATE ${Backtrace_LIBRARIES})
+ target_include_directories(${TARGET} PRIVATE ${Backtrace_INCLUDE_DIRS})
+ target_link_libraries(${TARGET} PRIVATE ${Backtrace_LIBRARIES})
+ set_property(SOURCE logbacktrace_unix.cpp posixsignalwatcher.cpp APPEND PROPERTY COMPILE_DEFINITIONS HAVE_BACKTRACE)
endif()
- target_sources(mod_common PRIVATE logbacktrace_unix.cpp posixsignalwatcher.cpp)
+ target_sources(${TARGET} PRIVATE logbacktrace_unix.cpp posixsignalwatcher.cpp)
endif()
if (APPLE)
- target_link_libraries(mod_common "-framework CoreServices" "-framework CoreFoundation")
+ target_sources(${TARGET} PRIVATE mac_utils.cpp)
+ target_link_libraries(${TARGET} PUBLIC "-framework CoreServices" "-framework CoreFoundation")
endif()
-target_link_libraries(mod_common ${CMAKE_DL_LIBS} ZLIB::ZLIB)
-
# This is needed so translations are generated before trying to build the qrc.
# Should probably find a nicer solution with proper dependencies between the involved files, though...
-add_dependencies(mod_common po)
+add_dependencies(${TARGET} po)
#include "protocol.h"
#include "syncableobject.h"
#include "types.h"
+#include "version.h"
#ifndef Q_OS_WIN
# include "posixsignalwatcher.h"
# include "windowssignalwatcher.h"
#endif
-#include "../../version.h"
-
Quassel::Quassel()
: Singleton<Quassel>{this}
, _logger{new Logger{this}}
-# Builds the core module
+quassel_add_module(Core)
-set(SOURCES
+target_sources(${TARGET} PRIVATE
abstractsqlstorage.cpp
authenticator.cpp
core.cpp
# needed for automoc
coreeventmanager.h
-)
-set(LIBS )
+ # Resources
+ sql.qrc
+)
-if(HAVE_SSL)
- set(SOURCES ${SOURCES} sslserver.cpp)
- include_directories(${OPENSSL_INCLUDE_DIR})
+if (HAVE_SSL)
+ target_sources(${TARGET} PRIVATE sslserver.cpp)
endif()
-# Build with LDAP if told to do so.
-if(HAVE_LDAP)
- include_directories(${LDAP_INCLUDE_DIR})
- set(SOURCES ${SOURCES} ldapauthenticator.cpp)
- set(MOC_HDRS ${MOC_HDRS} ldapauthenticator.h)
-endif(HAVE_LDAP)
-
-include_directories(${CMAKE_SOURCE_DIR}/src/common)
-
-set(CORE_RCS ${CORE_RCS} ${CMAKE_CURRENT_SOURCE_DIR}/sql.qrc)
-qt5_add_resources(SOURCES ${CORE_RCS})
-
-add_library(mod_core STATIC ${SOURCES})
-qt5_use_modules(mod_core Core Network Script Sql)
-
-target_link_libraries(mod_core mod_common ${LIBS})
+if (LDAP_FOUND)
+ target_sources(${TARGET} PRIVATE ldapauthenticator.cpp)
+ target_link_libraries(${TARGET} PRIVATE ${LDAP_LIBRARIES})
+ target_include_directories(${TARGET} PRIVATE ${LDAP_INCLUDE_DIR})
+ target_compile_definitions(${TARGET} PRIVATE -DHAVE_LDAP)
+endif()
if (Qca-qt5_FOUND)
- target_sources(mod_core PRIVATE cipher.cpp keyevent.cpp)
- target_link_libraries(mod_core qca-qt5)
- target_compile_definitions(mod_core PUBLIC -DHAVE_QCA2)
+ target_sources(${TARGET} PRIVATE cipher.cpp keyevent.cpp)
+ target_link_libraries(${TARGET} PUBLIC qca-qt5)
+ target_compile_definitions(${TARGET} PUBLIC -DHAVE_QCA2)
endif()
-if(HAVE_LDAP)
- target_link_libraries(mod_core ${LDAP_LIBRARIES})
-endif(HAVE_LDAP)
+target_link_libraries(${TARGET}
+ PUBLIC
+ Qt5::Core
+ Qt5::Network
+ Qt5::Script
+ Qt5::Sql
+ Quassel::Common
+)
--- /dev/null
+# Convenience function to avoid boilerplate
+function(setup_executable _target _define)
+ set_target_properties(${_target} PROPERTIES
+ COMPILE_FLAGS ${_define}
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
+ )
+ target_link_libraries(${_target} PRIVATE ${ARGN})
+ install(TARGETS ${_target} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+endfunction()
+
+# We need to initialize the appropriate resources, so let's give our main.cpp some hints
+if (EMBED_DATA)
+ set_source_files_properties(main.cpp PROPERTIES COMPILE_DEFINITIONS EMBED_DATA)
+endif()
+
+# Build the executables
+if (WANT_CORE)
+ add_executable(quasselcore main.cpp)
+ setup_executable(quasselcore -DBUILD_CORE Qt5::Core Quassel::Core)
+endif()
+
+if (WANT_CLIENT OR WANT_QTCLIENT)
+ add_executable(quasselclient WIN32 main.cpp)
+ setup_executable(quasselclient -DBUILD_QTUI Qt5::Core Qt5::Gui Quassel::QtUi)
+ if (WITH_KDE)
+ target_link_libraries(quasselclient PRIVATE KF5::CoreAddons)
+ endif()
+endif()
+
+if (WANT_MONO)
+ add_executable(quassel WIN32 main.cpp monoapplication.cpp)
+ setup_executable(quassel -DBUILD_MONO Qt5::Core Qt5::Gui Quassel::Core Quassel::QtUi)
+ if (WITH_KDE)
+ target_link_libraries(quassel PRIVATE KF5::CoreAddons)
+ endif()
+endif()
+
+# Build bundles for MacOSX
+if (APPLE)
+ add_custom_command(TARGET quasselclient POST_BUILD
+ COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
+ ${CMAKE_SOURCE_DIR} "Quassel Client" ${CMAKE_BINARY_DIR}/quasselclient)
+
+ add_custom_command(TARGET quassel POST_BUILD
+ COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
+ ${CMAKE_SOURCE_DIR} "Quassel" ${CMAKE_BINARY_DIR}/quassel)
+ if (DEPLOY)
+ add_custom_command(TARGET quasselclient POST_BUILD WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Client ${CMAKE_BINARY_DIR} qsvgicon)
+ add_custom_command(TARGET quasselcore POST_BUILD WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Core ${CMAKE_BINARY_DIR})
+ add_custom_command(TARGET quassel POST_BUILD WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Mono ${CMAKE_BINARY_DIR} qsvgicon)
+ endif()
+endif()
-# Builds the qtui module
+quassel_add_module(QtUi)
-set(SOURCES
+target_sources(${TARGET} PRIVATE
aboutdlg.cpp
awaylogfilter.cpp
awaylogview.cpp
topicwidget.cpp
verticaldock.cpp
webpreviewitem.cpp
-)
-set(FORMS
+ # UI files
aboutdlg.ui
bufferviewwidget.ui
bufferwidget.ui
topicwidget.ui
)
-set(LIBS )
-set(QT_MODULES )
+# Handle settingspages
+target_include_directories(${TARGET} PRIVATE settingspages)
+include(settingspages/settingspages.cmake)
+foreach(page ${SETTINGSPAGES})
+ target_sources(${TARGET} PRIVATE
+ settingspages/${page}settingspage.cpp
+ settingspages/${page}settingspage.ui
+ )
+endforeach()
+foreach(src ${SP_SOURCES})
+ target_sources(${TARGET} PRIVATE settingspages/${src})
+endforeach()
+foreach(form ${SP_FORMS})
+ target_sources(${TARGET} PRIVATE settingspages/${form})
+endforeach()
+
+target_link_libraries(${TARGET}
+ PUBLIC
+ Qt5::Core
+ Qt5::Gui
+ Qt5::Network
+ Qt5::Widgets
+ Quassel::UiSupport
+ Quassel::Client
+ Quassel::Common
+)
-if (WITH_KF5)
- list(APPEND SOURCES knotificationbackend.cpp)
- list(APPEND LIBS KF5::ConfigWidgets KF5::Notifications KF5::NotifyConfig KF5::WidgetsAddons KF5::XmlGui)
+if (WITH_KDE)
+ target_sources(${TARGET} PRIVATE knotificationbackend.cpp)
+ target_link_libraries(${TARGET} PUBLIC
+ KF5::ConfigWidgets
+ KF5::Notifications
+ KF5::NotifyConfig
+ KF5::WidgetsAddons
+ KF5::XmlGui
+ )
endif()
-if (LibsnoreQt5_FOUND)
- add_definitions(-DHAVE_LIBSNORE)
- list(APPEND SOURCES snorenotificationbackend.cpp)
- list(APPEND FORMS snorentificationconfigwidget.ui)
- list(APPEND LIBS Snore::Libsnore Snore::LibsnoreSettings)
+if (KF5Sonnet_FOUND)
+ target_compile_definitions(${TARGET} PRIVATE -DHAVE_SONNET)
+ target_sources(${TARGET} PRIVATE settingspages/sonnetsettingspage.cpp)
+ target_link_libraries(${TARGET} PRIVATE KF5::SonnetUi)
endif()
if (Qt5Multimedia_FOUND)
- add_definitions(-DHAVE_QTMULTIMEDIA)
- list(APPEND QT_MODULES Multimedia)
- set(SOURCES ${SOURCES} qtmultimedianotificationbackend.cpp)
- set(FORMS ${FORMS} qtmultimedianotificationconfigwidget.ui)
+ target_compile_definitions(${TARGET} PRIVATE -DHAVE_QTMULTIMEDIA)
+ target_sources(${TARGET} PRIVATE
+ qtmultimedianotificationbackend.cpp
+ qtmultimedianotificationconfigwidget.ui
+ )
+ target_link_libraries(${TARGET} PRIVATE Qt5::Multimedia)
endif()
if (Qt5DBus_FOUND)
- add_definitions(-DHAVE_DBUS)
- list(APPEND QT_MODULES DBus)
+ target_compile_definitions(${TARGET} PRIVATE -DHAVE_DBUS)
+ target_link_libraries(${TARGET} PRIVATE Qt5::DBus)
if (dbusmenu-qt5_FOUND)
- add_definitions(-DHAVE_DBUSMENU)
- include_directories(${dbusmenu-qt5_INCLUDE_DIRS})
- list(APPEND LIBS dbusmenu-qt5)
+ target_compile_definitions(${TARGET} PRIVATE -DHAVE_DBUSMENU)
+ target_link_libraries(${TARGET} PRIVATE dbusmenu-qt5)
endif()
- list(APPEND SOURCES statusnotifieritem.cpp statusnotifieritemdbus.cpp dockmanagernotificationbackend.cpp)
- qt5_add_dbus_interface(SOURCES ../../interfaces/org.kde.StatusNotifierWatcher.xml statusnotifierwatcher)
- qt5_add_dbus_interface(SOURCES ../../interfaces/org.freedesktop.Notifications.xml notificationsclient)
- qt5_add_dbus_adaptor (SOURCES ../../interfaces/org.kde.StatusNotifierItem.xml statusnotifieritemdbus.h StatusNotifierItemDBus)
+ qt5_add_dbus_interface(DBUS_SOURCES ../../interfaces/org.kde.StatusNotifierWatcher.xml statusnotifierwatcher)
+ qt5_add_dbus_interface(DBUS_SOURCES ../../interfaces/org.freedesktop.Notifications.xml notificationsclient)
+ qt5_add_dbus_adaptor (DBUS_SOURCES ../../interfaces/org.kde.StatusNotifierItem.xml statusnotifieritemdbus.h StatusNotifierItemDBus)
+
+ target_sources(${TARGET} PRIVATE
+ dockmanagernotificationbackend.cpp
+ statusnotifieritem.cpp
+ statusnotifieritemdbus.cpp
+ ${DBUS_SOURCES}
+ )
endif()
if (HAVE_WEBKIT)
- add_definitions(-DHAVE_WEBKIT)
- list(APPEND QT_MODULES WebKit WebKitWidgets)
+ target_compile_definitions(${TARGET} PRIVATE -DHAVE_WEBKIT)
+ target_link_libraries(${TARGET} PRIVATE
+ Qt5::WebKit
+ Qt5::WebKitWidgets
+ )
endif()
if (HAVE_WEBENGINE)
- add_definitions(-DHAVE_WEBENGINE)
- list(APPEND QT_MODULES WebEngine WebEngineWidgets)
+ target_compile_definitions(${TARGET} PRIVATE -DHAVE_WEBENGINE)
+ target_link_libraries(${TARGET} PRIVATE
+ Qt5::WebEngine
+ Qt5::WebEngineWidgets)
endif()
-if(HAVE_SSL)
- set(SOURCES ${SOURCES} sslinfodlg.cpp)
- set(FORMS ${FORMS} sslinfodlg.ui)
+if (HAVE_SSL)
+ target_sources(${TARGET} PRIVATE
+ sslinfodlg.cpp
+ sslinfodlg.ui
+ )
endif()
-if (WITH_NOTIFICATION_CENTER)
- add_definitions(-DHAVE_NOTIFICATION_CENTER)
- list(APPEND SOURCES osxnotificationbackend.mm)
- list(APPEND LIBS "/System/Library/Frameworks/Foundation.framework")
+if (LibsnoreQt5_FOUND)
+ target_compile_definitions(${TARGET} PRIVATE -DHAVE_LIBSNORE)
+ target_sources(${TARGET} PRIVATE
+ snorenotificationbackend.cpp
+ snorentificationconfigwidget.ui
+ )
+ target_link_libraries(${TARGET} PRIVATE Snore::Libsnore Snore::LibsnoreSettings)
endif()
-if (KF5Sonnet_FOUND)
- add_definitions(-DHAVE_SONNET)
- list(APPEND SOURCES settingspages/sonnetsettingspage.cpp)
- list(APPEND LIBS KF5::SonnetUi)
+if (WITH_NOTIFICATION_CENTER)
+ target_compile_definitions(${TARGET} PRIVATE -DHAVE_NOTIFICATION_CENTER)
+ target_sources(${TARGET} PRIVATE osxnotificationbackend.mm)
+ target_link_libraries(${TARGET} PRIVATE "/System/Library/Frameworks/Foundation.framework")
endif()
-
-foreach(FORM ${FORMS})
- set(FORMPATH ${FORMPATH} ui/${FORM})
-endforeach(FORM ${FORMS})
-
-# handle settingspages
-include(settingspages/settingspages.cmake)
-foreach(SP ${SETTINGSPAGES})
- set(SPSRC ${SPSRC} settingspages/${SP}settingspage.cpp)
- set(SPFRM ${SPFRM} settingspages/${SP}settingspage.ui)
-endforeach(SP ${SETTINGSPAGES})
-foreach(SRC ${SP_SOURCES})
- set(SPSRC ${SPSRC} settingspages/${SRC})
-endforeach(SRC ${SP_SOURCES})
-foreach(FRM ${SP_FORMS})
- set(SPFRM ${SPFRM} settingspages/${FRM})
-endforeach(FRM ${SP_FORMS})
-
-include_directories(${CMAKE_SOURCE_DIR}/src/common
- ${CMAKE_SOURCE_DIR}/src/client
- ${CMAKE_SOURCE_DIR}/src/qtui
- ${CMAKE_SOURCE_DIR}/src/qtui/settingspages
- ${CMAKE_SOURCE_DIR}/src/uisupport
-)
-
-qt5_wrap_ui(UI ${FORMPATH} ${SPFRM})
-
-add_library(mod_qtui STATIC ${SOURCES} ${SPSRC} ${UI})
-qt5_use_modules(mod_qtui Core Gui Network Widgets ${QT_MODULES})
-
-target_link_libraries(mod_qtui mod_client mod_common mod_uisupport ${LIBS})
servereditdlg.ui
)
-if (NOT KDE4_FOUND)
+if (NOT WITH_KDE)
list(APPEND SETTINGSPAGES shortcuts)
list(APPEND SP_SOURCES keysequencewidget.cpp shortcutsmodel.cpp)
endif()
-# Builds the uisupport module
+quassel_add_module(UiSupport)
-set(SOURCES
+target_sources(${TARGET} PRIVATE
aboutdata.cpp
abstractbuffercontainer.cpp
abstractitemview.cpp
abstractnotificationbackend.h
)
-include_directories(${CMAKE_SOURCE_DIR}/src/common
- ${CMAKE_SOURCE_DIR}/src/client
+target_link_libraries(${TARGET}
+ PUBLIC
+ Qt5::Core
+ Qt5::Gui
+ Qt5::Network
+ Qt5::Widgets
+ Quassel::Client
+ Quassel::Common
)
-add_library(mod_uisupport STATIC ${SOURCES})
-qt5_use_modules(mod_uisupport Core Gui Network Widgets)
-
-target_link_libraries(mod_uisupport mod_client mod_common)
-
if (WITH_KF5)
- target_link_libraries(mod_uisupport KF5::CoreAddons KF5::TextWidgets KF5::XmlGui)
+ target_link_libraries(${TARGET}
+ PUBLIC
+ KF5::CoreAddons
+ KF5::TextWidgets
+ KF5::XmlGui
+ )
endif()
if (KF5Sonnet_FOUND)
- add_definitions(-DHAVE_SONNET)
- target_link_libraries(mod_uisupport KF5::SonnetUi)
+ target_link_libraries(${TARGET} PRIVATE KF5::SonnetUi)
+ target_compile_definitions(${TARGET} PRIVATE -DHAVE_SONNET)
endif()