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

3
project(ksysguard)
4
set(PROJECT_VERSION "5.20.5")
5

6
set(KSYSGUARD_VERSION 4.98.0)
7 8
set(KSYSGUARD_STRING_VERSION "${KSYSGUARD_VERSION}")

9
set(QT_MIN_VERSION "5.15.0")
10
set(KF5_MIN_VERSION "5.74")
11

12
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
13
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}  ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
14 15 16 17

include(CheckIncludeFiles)
include(KDEInstallDirs)
include(KDECMakeSettings)
18
include(KDECompilerSettings NO_POLICY_SCOPE)
19
include(KDEClangFormat)
20 21 22 23 24 25 26
include(ECMAddTests)
include(ECMInstallIcons)
include(FeatureSummary)

find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
    Core
    Widgets
27
    Test
28
)
29
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
30
    Config
31
    CoreAddons
32 33
    DBusAddons
    DocTools
34
    I18n
35 36
    IconThemes
    Init
37
    ItemViews
38
    KIO
39
    NewStuff
40
    Notifications
41
    WindowSystem
42 43
)

44
find_package(KSysGuard REQUIRED)
45

46 47 48 49 50 51
find_package(KF5NetworkManagerQt ${KF5_MIN_VERSION})
set_package_properties(KF5NetworkManagerQt PROPERTIES
    TYPE RECOMMENDED
    PURPOSE "Provides an improved backend for Network statistics"
)

Laurent Montel's avatar
Laurent Montel committed
52 53
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DQT_USE_QSTRINGBUILDER)
54 55 56
#add_definitions(-DQT_NO_CAST_FROM_ASCII)
#add_definitions(-DQT_NO_CAST_TO_ASCII)
#add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
57 58
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
   add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
59
   add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054200)
60
endif()
61

62 63 64
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

65 66 67 68 69
find_package(Sensors)
set_package_properties(Sensors PROPERTIES
                       TYPE OPTIONAL
                       PURPOSE "Allows to show sensor information")

70 71 72 73 74 75 76
find_package(libpcap)
set_package_properties(
    libpcap PROPERTIES
    TYPE RECOMMENDED
    PURPOSE "libpcap is used for per-application network usage."
)

77 78 79 80 81 82 83 84 85
find_package(NL)
set_package_properties(NL PROPERTIES
    TYPE RECOMMENDED
    PURPOSE "Used for gathering socket info via the sock_diag netlink subsystem."
)
if(libpcap_FOUND AND NL_FOUND)
    set(BUILD_NETWORK_PLUGIN TRUE)
endif()

86 87 88 89 90 91 92 93
if (libpcap_FOUND)
    find_package(Libcap)
    set_package_properties(Libcap PROPERTIES
        TYPE OPTIONAL
        PURPOSE "Needed for setting capabilities of the per-application network plugin."
    )
endif()

94 95 96
include_directories(${CMAKE_CURRENT_BINARY_DIR})
configure_file(config-workspace.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-workspace.h)

97
add_subdirectory( gui )
98

99
add_subdirectory( doc )
100 101
add_subdirectory( pics )
add_subdirectory( example )
102

Aaron J. Seigo's avatar
Aaron J. Seigo committed
103
add_subdirectory( ksysguardd )
104

105
add_subdirectory(ksystemstats)
106 107
add_subdirectory(libkstats)

108 109
add_subdirectory( plugins )

110 111 112 113
# 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})

114 115
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)