CMakeLists.txt 4.65 KB
Newer Older
1
2
cmake_minimum_required(VERSION 3.0)

3
project(libksysguard)
4
set(PROJECT_VERSION "5.17.80")
5
set(PROJECT_VERSION_MAJOR 5)
6

7
# check with non-Plasma consumers (e.g. KDevelop) before bumping these versions
8
set(QT_MIN_VERSION "5.11.0")
9
set(KF5_MIN_VERSION "5.62.0")
10
11

find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
12
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
13

14
15
16
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
17
include(KDEClangFormat)
18
19
20
21
22
23
24
25
26
27
28

include(ECMAddTests)
include(ECMInstallIcons)
include(ECMSetupVersion)
include(ECMQtDeclareLoggingCategory)

include(CMakePackageConfigHelpers)
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(FeatureSummary)

29
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED CONFIG COMPONENTS DBus Network Widgets WebChannel)
Fabian Vogt's avatar
Fabian Vogt committed
30
31
32
33
find_package(Qt5WebEngineWidgets ${QT_MIN_VERSION} CONFIG)
set_package_properties(Qt5WebEngineWidgets PROPERTIES
                       URL "git://code.qt.org/qt/qtwebenginewidgets.git"
                       DESCRIPTION "Qt WebEngine module (web browsing engine)"
34
35
36
37
                       TYPE OPTIONAL
                       PURPOSE "Used by the HTML-based GUI ksysguard library"
                      )

38
find_package(KF5 REQUIRED COMPONENTS CoreAddons Config I18n WindowSystem Completion Auth WidgetsAddons IconThemes ConfigWidgets Service GlobalAccel KIO)
39
40
41
42
43
44
45
46
find_package(KF5 OPTIONAL_COMPONENTS Plasma)
set_package_properties(KF5Plasma PROPERTIES
                       URL "https://cgit.kde.org/plasma-framework.git/"
                       DESCRIPTION "The library of the plasma project"
                       TYPE OPTIONAL
                       PURPOSE "Used by signalplotter to use Plasma themes"
                      )

47
48
49
50
51
52
find_package(ZLIB REQUIRED)
set_package_properties(ZLIB PROPERTIES DESCRIPTION "Support for gzip compressed files and data streams"
                       URL "http://www.zlib.net"
                       TYPE REQUIRED
                      )

Kevin Funk's avatar
Kevin Funk committed
53
54
check_library_exists(c clock_gettime "time.h" HAVE_CLOCK_GETTIME_C)

Eike Hein's avatar
Eike Hein committed
55
56
57
58
ecm_setup_version(${PROJECT_VERSION}
                  VARIABLE_PREFIX KSYSGUARD
                  VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/ksysguard_version.h"
                  PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5SysGuardConfigVersion.cmake"
59
                  SOVERSION 7
Eike Hein's avatar
Eike Hein committed
60
)
61

62
63
find_package(X11)
set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries"
64
                        URL "https://www.x.org"
65
66
67
68
69
                        TYPE OPTIONAL
                        PURPOSE "Required for building the X11 based workspace"
                    )
if(X11_FOUND)
    find_package(Qt5X11Extras REQUIRED)
70
71
72
73
74
    find_library(X11_XRes_LIB XRes ${X11_LIB_SEARCH_PATH})
    find_path(X11_XRes_INCLUDE_PATH X11/extensions/XRes.h ${X11_INC_SEARCH_PATH})

    if(X11_XRes_LIB AND X11_XRes_INCLUDE_PATH)
        set(X11_XRes_FOUND TRUE)
75
76
    endif()
endif()
77

Michael Palimaka's avatar
Michael Palimaka committed
78
set(HAVE_X11 ${X11_FOUND})
79
set(HAVE_XRES ${X11_XRes_FOUND})
Fabian Vogt's avatar
Fabian Vogt committed
80
set(HAVE_QTWEBENGINEWIDGETS ${Qt5WebEngineWidgets_FOUND})
81
82
configure_file(config-ksysguard.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-ksysguard.h )

83
84
85
86
87
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DQT_USE_QSTRINGBUILDER)
add_definitions(-DQT_NO_CAST_FROM_ASCII)
add_definitions(-DQT_NO_CAST_TO_ASCII)
add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
88
89
90
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
    add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000)
endif()
91

92
93
94
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

95
add_subdirectory( lsofui )
96
add_subdirectory( processcore )
97
add_subdirectory( processui )
98
99
100
if (KF5Plasma_FOUND)
    add_subdirectory( signalplotter )
endif()
Bhushan Shah's avatar
Bhushan Shah committed
101
add_subdirectory( ksgrd )
Michael Palimaka's avatar
Michael Palimaka committed
102
103

if(BUILD_TESTING)
104
    add_subdirectory( tests )
Michael Palimaka's avatar
Michael Palimaka committed
105
endif()
106

107
108
109
110
# add clang-format target for all our real source files
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})

111
install(DIRECTORY scripts/ DESTINATION ${KDE_INSTALL_DATADIR}/ksysguard/scripts)
112

113
set(CMAKECONFIG_INSTALL_DIR ${KDE_INSTALL_LIBDIR}/cmake/KF5SysGuard)
114
configure_package_config_file(KF5SysGuardConfig.cmake.in
115
116
    "${CMAKE_CURRENT_BINARY_DIR}/KF5SysGuardConfig.cmake"
    INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR})
117

118
119
120
install(FILES
		${CMAKE_CURRENT_BINARY_DIR}/KF5SysGuardConfig.cmake
		${CMAKE_CURRENT_BINARY_DIR}/KF5SysGuardConfigVersion.cmake
121
122
123
124
125
126
127
        DESTINATION ${CMAKECONFIG_INSTALL_DIR})

install(EXPORT libksysguardLibraryTargets
        NAMESPACE KF5::
        DESTINATION ${CMAKECONFIG_INSTALL_DIR}
        FILE KF5SysGuardLibraryTargets.cmake )

Laurent Montel's avatar
Laurent Montel committed
128
install(FILES libksysguard.categories  DESTINATION  ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
129

130
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)