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

3
project(PowerDevil)
4
set(PROJECT_VERSION "5.20.80")
5
set(PROJECT_VERSION_MAJOR 5)
6

7
set(QT_MIN_VERSION "5.15.0")
8
set(KF5_MIN_VERSION "5.74")
9

10
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
11
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}  ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
12

Kai Uwe Broulik's avatar
Kai Uwe Broulik committed
13
include(ECMSetupVersion)
14
include(ECMQtDeclareLoggingCategory)
15
include(ECMConfiguredInstall)
16 17 18
include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
19
include(KDECompilerSettings NO_POLICY_SCOPE)
20
include(KDEClangFormat)
21 22

find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Widgets DBus X11Extras)
23
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Activities Auth IdleTime Config DBusAddons Solid I18n GlobalAccel KIO NotifyConfig Wayland DocTools Crash Notifications)
24
find_package(KF5Screen CONFIG REQUIRED)
25
find_package(LibKWorkspace CONFIG REQUIRED)
26

27
find_package(KF5BluezQt ${KF5_MIN_VERSION})
28 29 30 31 32
set_package_properties(KF5BluezQt
    PROPERTIES DESCRIPTION "Qt wrapper for BlueZ 5 DBus API"
    TYPE OPTIONAL
    PURPOSE "Support for wireless energy saving actions"
)
33
find_package(KF5NetworkManagerQt ${KF5_MIN_VERSION})
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
set_package_properties(KF5NetworkManagerQt
    PROPERTIES DESCRIPTION "Qt wrapper for NetworkManager API"
    TYPE OPTIONAL
    PURPOSE "Support for wireless energy saving actions"
)

set(HAVE_WIRELESS_SUPPORT FALSE)
if(KF5NetworkManagerQt_FOUND AND KF5BluezQt_FOUND)
    set(HAVE_WIRELESS_SUPPORT TRUE)
endif()
add_feature_info(
    "Wireless power saving"
    HAVE_WIRELESS_SUPPORT
    "Support turning off signal-transmitting devices to save energy"
)

50 51
find_package(LibKWorkspace ${PROJECT_VERSION} REQUIRED)

Kai Uwe Broulik's avatar
Kai Uwe Broulik committed
52
find_package(UDev REQUIRED)
Dario Freddi's avatar
Dario Freddi committed
53

54
find_package(XCB REQUIRED COMPONENTS XCB RANDR DPMS)
55

56 57 58 59 60 61 62
find_package(Libcap)
set_package_properties(Libcap PROPERTIES
    TYPE OPTIONAL
    PURPOSE "Needed for scheduled wakeup which can wake from suspend (CAP_WAKE_ALARM)"
)
set(HAVE_LIBCAP ${Libcap_FOUND})

63 64 65
option(HAVE_DDCUTIL "DDCUtil library support" OFF)
if(HAVE_DDCUTIL)
    find_package(DDCUtil REQUIRED)
66
    add_definitions(-DWITH_DDCUTIL)
67 68 69 70 71
    set_package_properties(DDCUtil
        PROPERTIES DESCRIPTION "DDCUtil library support"
        TYPE OPTIONAL
        PURPOSE "Set monitor settings over DDC/CI channel"
    )
Jonathan Riddell's avatar
Jonathan Riddell committed
72
else()
Yuri Chornoivan's avatar
Yuri Chornoivan committed
73
    add_feature_info("DDCUtil" HAVE_DDCUTIL "DDCUtil library support is disabled by default as recommended by authors, add -DHAVE_DDCUTIL=On to enable")
74 75
endif()

Dario Freddi's avatar
Dario Freddi committed
76
include_directories (
77 78
    ${CMAKE_CURRENT_BINARY_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/daemon
Dario Freddi's avatar
Dario Freddi committed
79 80
)

81
add_definitions(-DQT_NO_KEYWORDS)
Nicolas Fella's avatar
Nicolas Fella committed
82
add_definitions(-DQT_NO_FOREACH)
83

Dario Freddi's avatar
Dario Freddi committed
84
add_subdirectory(daemon)
Àlex Fiestas's avatar
Àlex Fiestas committed
85
add_subdirectory(kcmodule)
86
add_subdirectory(doc)
Dario Freddi's avatar
Dario Freddi committed
87

88
install( FILES powerdevil.categories  DESTINATION  ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
89
install( FILES powerdevil.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFY5RCDIR} )
90

91 92 93 94
# 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})

95
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)