CMakeLists.txt 3.86 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.25.80")
6
set(PROJECT_VERSION_MAJOR 5)
Jan Grulich's avatar
Jan Grulich committed
7

8
set(QT_MIN_VERSION "5.15.2")
9
set(KF5_MIN_VERSION "5.94")
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)
Laurent Montel's avatar
Laurent Montel committed
24
include(ECMFindQmlModule)
25
include(KDEGitCommitHooks)
Laurent Montel's avatar
Laurent Montel committed
26
include(ECMQtDeclareLoggingCategory)
27

28
include(FeatureSummary)
Jan Grulich's avatar
Jan Grulich committed
29

30
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Jan Grulich's avatar
Jan Grulich committed
31
32
33
34
    Core
    DBus
    Network
    Quick
35
    QuickWidgets
Jan Grulich's avatar
Jan Grulich committed
36
37
    Widgets
)
38

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

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

61
62
ecm_find_qmlmodule(org.kde.prison 1.0)

63
64
65
66
67
68
69
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
)

70
find_package(Qca-qt${QT_MAJOR_VERSION} 2.1.0)
Laurent Montel's avatar
Laurent Montel committed
71
set_package_properties(Qca-qt${QT_MAJOR_VERSION} PROPERTIES DESCRIPTION "Support for encryption"
72
                       URL "https://download.kde.org/stable/qca-qt5/"
73
74
                       TYPE REQUIRED)

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

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

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

Laurent Montel's avatar
Laurent Montel committed
101
102
103
104
105
106
107
108
add_definitions(
    -DQT_DISABLE_DEPRECATED_BEFORE=0x050f00
    -DQT_DEPRECATED_WARNINGS_SINCE=0x060000
    -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055800
    -DKF_DEPRECATED_WARNINGS_SINCE=0x060000
)


109
110
111
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
112

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

Jan Grulich's avatar
Jan Grulich committed
115
add_subdirectory(applet)
116
add_subdirectory(kded)
Jan Grulich's avatar
Jan Grulich committed
117
add_subdirectory(kcm)
Jan Grulich's avatar
Jan Grulich committed
118
add_subdirectory(libs)
Jan Grulich's avatar
Jan Grulich committed
119
add_subdirectory(vpn)
Jan Grulich's avatar
Jan Grulich committed
120
121
122
123

if (BUILD_MOBILE)
    add_subdirectory(mobile)
endif()
124
125
126
127

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

130
131
132
# 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})
133
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
134

Laurent Montel's avatar
Laurent Montel committed
135
136
137
138
139
140
ecm_qt_install_logging_categories(
        EXPORT PLASMANM
        FILE plasma-nm.categories
        DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
        )

141
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)