CMakeLists.txt 3.48 KB
Newer Older
1
project(discover)
2
set(PROJECT_VERSION "5.20.80")
3
4
set(PROJECT_VERSION_MAJOR 5)

5
cmake_minimum_required(VERSION 2.8.12)
6

7
set(QT_MIN_VERSION "5.15.0")
8
set(KF5_MIN_VERSION "5.78")
Laurent Montel's avatar
Laurent Montel committed
9
10

find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
11

12
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}  "${CMAKE_SOURCE_DIR}/cmake")
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
13

David Edmundson's avatar
David Edmundson committed
14
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED CONFIG COMPONENTS Widgets Test Network Xml Concurrent DBus Quick X11Extras)
15
16
include(KDEInstallDirs)
include(KDECMakeSettings)
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
17
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
18
include(ECMInstallIcons)
19
include(ECMMarkAsTest)
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
20
include(ECMAddTests)
21
include(GenerateExportHeader)
Laurent Montel's avatar
Laurent Montel committed
22
include(ECMQtDeclareLoggingCategory)
23
include(KDEClangFormat)
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
24

Jan Grulich's avatar
Jan Grulich committed
25
26
find_package(PkgConfig REQUIRED)

27
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED CoreAddons Config Crash DBusAddons I18n Archive XmlGui ItemModels KIO Declarative KCMUtils IdleTime)
28
find_package(KF5Kirigami2 2.7.0)
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
29

30
find_package(packagekitqt5 1.0.1 CONFIG)
31
find_package(AppStreamQt 0.12.8 CONFIG)
32
find_package(KF5Attica 5.23 CONFIG)
33
find_package(KF5NewStuff 5.53 CONFIG)
34

35
pkg_check_modules(Flatpak IMPORTED_TARGET flatpak>=0.11.8)
36
pkg_check_modules(Fwupd IMPORTED_TARGET fwupd>=1.0.6)
37
pkg_check_modules(Markdown IMPORTED_TARGET libmarkdown)
38
39
find_package(KUserFeedback)

Jan Grulich's avatar
Jan Grulich committed
40

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
41
42
43
44
45
46
if(NOT CMAKE_VERSION VERSION_LESS "3.10.0")
  # CMake 3.9+ warns about automoc on files without Q_OBJECT, and doesn't know about other macros.
  # 3.10+ lets us provide more macro names that require automoc.
  list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "DISCOVER_BACKEND_PLUGIN")
endif()

47
48
set(CMAKE_CXX_STANDARD 14)

49
configure_file(DiscoverVersion.h.in DiscoverVersion.h)
50

51
add_subdirectory(libdiscover)
52
add_subdirectory(discover)
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
53
add_subdirectory(exporter)
54
add_subdirectory(update)
55
add_subdirectory(kcm)
56
57
58
59
60
61

option(WITH_NOTIFIER "Build and install the notifier plasmoid" ON)
if(WITH_NOTIFIER)
    find_package(KF5 REQUIRED Notifications KIO)
    add_subdirectory(notifier)
endif()
62

63
set_package_properties(KF5Attica PROPERTIES
64
    DESCRIPTION "KDE Framework that implements the Open Collaboration Services API"
65
66
    PURPOSE "Required to build the KNewStuff3 backend"
    TYPE OPTIONAL)
67
set_package_properties(KF5Kirigami2 PROPERTIES
Harald Sitter's avatar
Harald Sitter committed
68
    DESCRIPTION "KDE's lightweight user interface framework for mobile and convergent applications"
69
70
71
    URL "https://techbase.kde.org/Kirigami"
    PURPOSE "Required by discover qml components"
    TYPE RUNTIME)
72
73
74
75
set_package_properties(KF5NewStuff PROPERTIES
    DESCRIPTION "Qt library that allows to interact with KNewStuff implementations"
    PURPOSE "Required to build the KNS backend"
    TYPE OPTIONAL)
76
set_package_properties(packagekitqt5 PROPERTIES
77
    DESCRIPTION "Library that exposes PackageKit resources"
Volker Krause's avatar
Volker Krause committed
78
    URL "https://www.freedesktop.org/software/PackageKit/"
79
80
    PURPOSE "Required to build the PackageKit backend"
    TYPE OPTIONAL)
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
81
set_package_properties(AppStreamQt PROPERTIES
82
    DESCRIPTION "Library that lists Appstream resources"
Volker Krause's avatar
Volker Krause committed
83
    URL "https://www.freedesktop.org"
84
    PURPOSE "Required to build the PackageKit and Flatpak backends"
85
    TYPE OPTIONAL)
86
87
88
89
add_feature_info(Flatpak Flatpak_FOUND
                "Library that exposes flatpak repositories. Required to build the Flatpak backend"
)
add_feature_info(Fwupd Fwupd_FOUND "Exposes fwupd")
90
91

feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
Laurent Montel's avatar
Laurent Montel committed
92

93
94
95
96
# 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})

Laurent Montel's avatar
Laurent Montel committed
97
install(FILES discover.categories  DESTINATION  ${KDE_INSTALL_LOGGINGCATEGORIESDIR})