CMakeLists.txt 3.5 KB
Newer Older
1
cmake_minimum_required(VERSION 3.16)
Jan Grulich's avatar
Jan Grulich committed
2

3
project(plasma-networkmanagement)
Jan Grulich's avatar
Jan Grulich committed
4

5
set(PROJECT_VERSION "5.23.0")
6
set(PROJECT_VERSION_MAJOR 5)
Jan Grulich's avatar
Jan Grulich committed
7

8
set(QT_MIN_VERSION "5.15.0")
9
set(KF5_MIN_VERSION "5.86")
10
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
11

Nicolas Fella's avatar
Nicolas Fella committed
12
13
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Nicolas Fella's avatar
Nicolas Fella committed
14

15
16
################# set KDE specific information #################

17
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
18
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
19
20
21

include(KDEInstallDirs)
include(KDECMakeSettings)
22
include(KDECompilerSettings NO_POLICY_SCOPE)
23
include(KDEClangFormat)
24
include(ECMQMLModules)
25
include(KDEGitCommitHooks)
26

27
include(FeatureSummary)
Jan Grulich's avatar
Jan Grulich committed
28
29
30
31
32
33

find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
    Core
    DBus
    Network
    Quick
34
    QuickWidgets
Jan Grulich's avatar
Jan Grulich committed
35
36
    Widgets
)
37

38
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED
39
    ConfigWidgets
40
41
    Completion
    CoreAddons
42
    Declarative
43
    DBusAddons
44
45
46
    KIO
    I18n
    NetworkManagerQt
47
48
    Notifications
    Plasma
49
50
51
52
53
    Service
    Solid
    Wallet
    WidgetsAddons
    WindowSystem
54
)
55

56
find_package(KF5ModemManagerQt ${KF5_MIN_VERSION})
Jan Grulich's avatar
Jan Grulich committed
57
58
set_package_properties(KF5ModemManagerQt PROPERTIES
                       TYPE OPTIONAL)
Jan Grulich's avatar
Jan Grulich committed
59

60
61
ecm_find_qmlmodule(org.kde.prison 1.0)

62
63
64
65
66
67
68
find_package(KF5Kirigami2 ${KF5_MIN_VERSION} CONFIG)
set_package_properties(KF5Kirigami2 PROPERTIES
    DESCRIPTION "A QtQuick based components set"
    PURPOSE "Required at runtime by the KCMs"
    TYPE RUNTIME
)

69
70
find_package(Qca-qt5 2.1.0)
set_package_properties(Qca-qt5 PROPERTIES DESCRIPTION "Support for encryption"
71
                       URL "https://download.kde.org/stable/qca-qt5/"
72
73
                       TYPE REQUIRED)

74
75
find_package(KF5Prison ${KF5_MIN_VERSION})
set_package_properties(KF5Prison PROPERTIES DESCRIPTION "Prison library"
76
                       URL "https://commits.kde.org/prison"
77
78
79
80
                       TYPE RUNTIME
                       PURPOSE "Needed to create mobile barcodes for WiFi networks"
                      )

81
82
find_package(PkgConfig REQUIRED)
pkg_check_modules(OPENCONNECT IMPORTED_TARGET openconnect>3.99)
83
84
pkg_check_modules(NETWORKMANAGER IMPORTED_TARGET libnm>1.4.0 REQUIRED)
pkg_check_modules(MOBILEBROADBANDPROVIDERINFO mobile-broadband-provider-info)
85
pkg_get_variable(BROADBANDPROVIDER_DATABASE mobile-broadband-provider-info database)
86

Jan Grulich's avatar
Jan Grulich committed
87
88
89
if (DISABLE_MODEMMANAGER_SUPPORT)
    message(STATUS "Disabling ModemManager support")
    set(WITH_MODEMMANAGER_SUPPORT 0)
90
else()
91
    if (KF5ModemManagerQt_FOUND)
Jan Grulich's avatar
Jan Grulich committed
92
93
        message(STATUS "Enabling ModemManager support")
        set(WITH_MODEMMANAGER_SUPPORT 1)
94
    else()
95
        message(STATUS "ModemManager or ModemManagerQt not found")
Jan Grulich's avatar
Jan Grulich committed
96
        set(WITH_MODEMMANAGER_SUPPORT 0)
97
98
    endif()
endif()
Jan Grulich's avatar
Jan Grulich committed
99

Jan Grulich's avatar
Jan Grulich committed
100
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0)
101
add_definitions(-DQT_USE_FAST_OPERATOR_PLUS)
102
103
104
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)

remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY)
Jan Grulich's avatar
Jan Grulich committed
105

Jan Grulich's avatar
Jan Grulich committed
106
add_definitions(-DWITH_MODEMMANAGER_SUPPORT=${WITH_MODEMMANAGER_SUPPORT})
Daniel Nicoletti's avatar
Daniel Nicoletti committed
107

Jan Grulich's avatar
Jan Grulich committed
108
add_subdirectory(applet)
109
add_subdirectory(kded)
Jan Grulich's avatar
Jan Grulich committed
110
add_subdirectory(kcm)
Jan Grulich's avatar
Jan Grulich committed
111
add_subdirectory(libs)
Jan Grulich's avatar
Jan Grulich committed
112
add_subdirectory(vpn)
Jan Grulich's avatar
Jan Grulich committed
113
114
115
116

if (BUILD_MOBILE)
    add_subdirectory(mobile)
endif()
117
118
119
120

# Enable unit testing
if (BUILD_TESTING)
    add_subdirectory(tests)
Jan Grulich's avatar
Jan Grulich committed
121
endif()
Harald Sitter's avatar
Harald Sitter committed
122

123
124
125
# 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})
126
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
127

128
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)