kde-extraapps/kuassel/CMakeLists.txt
Ivailo Monev ca6ec59cc7 generic: replace macro_log_feature() with set_package_properties() calls
other changes such as syncing properties, updating some of the URLs,
adding missing feature information, removing of redundant checks and
variables and indentation were done in the process while testing if the
changes work as intended.

replacing find_package() with macro_optional_find_package() was also done
where applicable however it's usage is questionable due to the CMake
`CMAKE_DISABLE_FIND_PACKAGE_<PACKAGE>` option.

there is a lot to be done, mostly updating package properties so I am
thinking of either providing a package properties file (like the
MacroLibrary) which sets properties for packages globablly or setting
package properties from the CMake modules shipped with kdelibs. the first
solution may override properties for packages if other projects define them
however a check to ensure that is not done should suffice. the second
solution will cover only DESCRIPTION and URL meaning PURPOSE and TYPE will
still have to be specified in the build systems.

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
2020-02-21 05:37:28 +02:00

146 lines
4.6 KiB
CMake

# Main CMake file for building Kuassel IRC
#
# See INSTALL for possible CMake options (or read the code, Luke)
#####################################################################
# General setup
#####################################################################
project(KuasselIRC)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
find_package(KDE4 4.19.0 REQUIRED)
include(KDE4Defaults)
include_directories(${KDE4_INCLUDES})
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
endif()
# Version
set(QUASSEL_VERSION_STRING "0.12")
# General conveniences
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Tell CMake about or own modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
# Include various CMake modules...
include(CMakePushCheckState)
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckCXXSourceCompiles)
include(CMakeDependentOption)
include(FeatureSummary)
# ... and our own stuff
include(QuasselCompileSettings)
# 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 (CMAKE_MAJOR_VERSION GREATER 2)
cmake_policy(SET CMP0043 OLD)
endif()
# Options and variables that can be set on the command line
#####################################################################
# Find package dependencies
#
# Note that you can forcefully disable optional packages
# using -DCMAKE_DISABLE_FIND_PACKAGE_<PkgName>=TRUE
#####################################################################
macro_optional_find_package(DBusMenuQt)
set_package_properties(DBusMenuQt PROPERTIES
DESCRIPTION "Library that provides a Qt implementation of the DBusMenu spec"
URL "https://github.com/fluxer/libdbusmenu-qt"
PURPOSE "Required for having a context menu for the D-Bus-based tray icon"
)
macro_optional_find_package(IndicateQt)
set_package_properties(IndicateQt PROPERTIES
DESCRIPTION "a library to raise flags on DBus for other components of the desktop to pick up and visualize"
URL "https://launchpad.net/libindicate-qt/"
PURPOSE "Provides integration into the Ayatana notification system used by e.g. Ubuntu"
)
macro_optional_find_package(QCA2)
set_package_properties(QCA2 PROPERTIES
DESCRIPTION "Qt Cryptographic Architecture"
URL "https://github.com/fluxer/qca"
PURPOSE "Required for encryption support"
)
find_package(ZLIB)
set_package_properties(ZLIB PROPERTIES
DESCRIPTION "General purpose data compression library"
URL "http://www.zlib.net"
PURPOSE "Required for protocol compression"
TYPE REQUIRED
)
macro_optional_find_package(ExecInfo QUIET)
set_package_properties(ExecInfo PROPERTIES
DESCRIPTION "a library for inspecting backtraces"
PURPOSE "Used for generating backtraces in case of a crash"
)
# Various checks
#####################################################################
# Check for SSL support in Qt
# As there's no easy way to get Qt's configuration in particular for Qt5, let's just compile
# a small test program checking the defines. This works for both Qt4 and Qt5.
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_INCLUDES ${QT_INCLUDES})
check_cxx_source_compiles("
#include \"qglobal.h\"
#if defined QT_NO_OPENSSL || defined QT_NO_SSL
# error \"No SSL support\"
#endif
int main() {}"
HAVE_SSL)
cmake_pop_check_state()
if (HAVE_SSL)
add_definitions(-DHAVE_SSL)
endif()
add_feature_info("SSL support in Qt" HAVE_SSL "Use secure network connections")
# Various settings
##################
# RPATH needs to be set correctly
# Do this down here, since otherwise KDE wants to handle it itself, and fails
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH 1)
set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
if(INDICATEQT_FOUND)
add_definitions(-DXDG_APPS_INSTALL_DIR=${KDE4_XDG_APPS_INSTALL_DIR})
endif()
check_function_exists(umask HAVE_UMASK)
if(HAVE_UMASK)
add_definitions(-DHAVE_UMASK)
endif(HAVE_UMASK)
configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h @ONLY)
# 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(pics)
# Finally, compile the sources
# We want this after displaying the feature summary to avoid ugly
# CMake backtraces in case a required Qt5 modules misses
#####################################################################
add_subdirectory(src)