Clean-up requirements: cmake 3.0, qt 5.7, use min versions, deduplicate KF5

Summary:
* cmake 2.8.12 is really outdated, 3.0 is minimum in plasma & kf5
* cmake_minimum_required should be at begin of toplevel CMakeLists.txt
* bump qt version to 5.7, matching the min Qt version of kf5 5.42
* with ecm being part of kf5 since early versions, share ${KF5_MIN_VERSION}
* use QT_MIN_VERSION & KF5_MIN_VERSION also for separate find_package calls
* deduplicate all KF5 components searched for in unconditionally included
  subdirs

Test Plan: Still configures and builds with all options OFF & ON

Reviewers: #kde_connect, nicolasfella

Reviewed By: #kde_connect, nicolasfella

Subscribers: nicolasfella

Differential Revision: https://phabricator.kde.org/D11418
This commit is contained in:
Friedrich W. H. Kossebau 2018-03-17 18:52:45 +01:00
parent 1f0d6b2a62
commit bb3ab8b631
20 changed files with 13 additions and 43 deletions

View file

@ -1,3 +1,5 @@
cmake_minimum_required(VERSION 3.0)
project(kdeconnect)
set(KDECONNECT_VERSION_MAJOR 1)
@ -5,15 +7,16 @@ set(KDECONNECT_VERSION_MINOR 2)
set(KDECONNECT_VERSION_PATCH 1)
set(KDECONNECT_VERSION "${KDECONNECT_VERSION_MAJOR}.${KDECONNECT_VERSION_MINOR}.${KDECONNECT_VERSION_PATCH}")
cmake_minimum_required(VERSION 2.8.12)
set(QT_MIN_VERSION "5.7.0")
set(KF5_MIN_VERSION "5.42.0")
find_package(ECM 0.0.9 REQUIRED NO_MODULE)
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake)
find_package(Qt5 5.2 REQUIRED COMPONENTS Quick)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Quick)
find_package(KF5 5.42.0 REQUIRED COMPONENTS I18n ConfigWidgets DBusAddons)
find_package(KF5DocTools)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS I18n ConfigWidgets DBusAddons IconThemes Notifications KIO KCMUtils)
find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS DocTools)
find_package(Qca-qt5 2.1.0 REQUIRED)
include_directories(${CMAKE_SOURCE_DIR})

View file

@ -1,4 +1,4 @@
find_package(KF5 COMPONENTS Declarative)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Declarative)
qt5_add_resources(kcapp_SRCS resources.qrc)

View file

@ -11,12 +11,10 @@ add_subdirectory(backends/loopback)
option(BLUETOOTH_ENABLED "Bluetooth support for kdeconnect" OFF)
if(BLUETOOTH_ENABLED)
find_package(Qt5 REQUIRED COMPONENTS Bluetooth)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Bluetooth)
add_subdirectory(backends/bluetooth)
endif()
find_package(KF5Notifications 5.9 REQUIRED)
set(kdeconnectcore_SRCS
${backends_kdeconnect_SRCS}

View file

@ -1,7 +1,5 @@
project(kdeconnectd)
find_package(KF5 REQUIRED COMPONENTS Notifications KIO)
add_definitions(-DTRANSLATION_DOMAIN="kdeconnect-kded")
add_executable(kdeconnectd kdeconnectd.cpp)

View file

@ -1,5 +1,3 @@
find_package(KF5 REQUIRED COMPONENTS KIO)
add_definitions(-DTRANSLATION_DOMAIN="kdeconnect-fileitemaction")
include_directories(${CMAKE_SOURCE_DIR})

View file

@ -1,6 +1,3 @@
find_package(KF5Notifications REQUIRED)
find_package(KF5KCMUtils REQUIRED)
set(indicator_SRCS
main.cpp
deviceindicator.cpp

View file

@ -1,7 +1,5 @@
add_definitions(-DTRANSLATION_DOMAIN="kdeconnect-kcm")
find_package(KF5KCMUtils 5.9 REQUIRED)
include_directories(${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}

View file

@ -2,8 +2,6 @@ project(kdeconnectpluginkcm)
add_definitions(-DTRANSLATION_DOMAIN=\"kdeconnect-core\")
find_package(KF5 REQUIRED COMPONENTS KCMUtils)
add_library(kdeconnectpluginkcm kdeconnectpluginkcm.cpp)
target_link_libraries(kdeconnectpluginkcm
PUBLIC

View file

@ -1,6 +1,5 @@
include_directories(${CMAKE_SOURCE_DIR})
add_definitions(-DTRANSLATION_DOMAIN="kdeconnect-kio")
find_package(KF5 REQUIRED COMPONENTS KIO)
set(kio_kdeconnect_PART_SRCS
kiokdeconnect.cpp

View file

@ -1,5 +1,3 @@
find_package(KF5 REQUIRED COMPONENTS Notifications)
set(kdeconnect_battery_SRCS
batteryplugin.cpp
batterydbusinterface.cpp

View file

@ -8,9 +8,9 @@ set_package_properties(LibFakeKey PROPERTIES DESCRIPTION "fake key events"
if (LibFakeKey_FOUND)
find_package(XTest REQUIRED)
find_package(X11 REQUIRED)
find_package(Qt5X11Extras REQUIRED)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras)
endif()
find_package(KF5Wayland 5.3.90)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Wayland)
set(HAVE_X11 ${LibFakeKey_FOUND})
set(HAVE_WAYLAND ${KF5Wayland_FOUND})

View file

@ -1,5 +1,3 @@
find_package(KF5 REQUIRED COMPONENTS Notifications KCMUtils I18n IconThemes Config)
set(kdeconnect_notifications_SRCS
notification.cpp
notificationsplugin.cpp
@ -16,5 +14,4 @@ target_link_libraries(kdeconnect_notifications
Qt5::DBus
KF5::Notifications
KF5::I18n
KF5::IconThemes
)

View file

@ -1,4 +1,3 @@
find_package(KF5 REQUIRED COMPONENTS KCMUtils)
find_program(PACTL pactl)
kdeconnect_add_plugin(kdeconnect_pausemusic JSON kdeconnect_pausemusic.json SOURCES pausemusicplugin.cpp)

View file

@ -1,5 +1,3 @@
find_package(KF5 REQUIRED COMPONENTS Notifications)
set(kdeconnect_ping_SRCS
pingplugin.cpp
)

View file

@ -1,5 +1,3 @@
find_package(KF5 REQUIRED COMPONENTS Notifications)
set(kdeconnect_screensaver_inhibit_SRCS
screensaverinhibitplugin.cpp
)

View file

@ -1,5 +1,3 @@
find_package(KF5 REQUIRED COMPONENTS Notifications KCMUtils I18n IconThemes)
set(kdeconnect_sendnotifications_SRCS
sendnotificationsplugin.cpp
notificationslistener.cpp

View file

@ -2,8 +2,6 @@
find_program(HAVE_FUSERMOUNT fusermount)
configure_file(config-sftp.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-sftp.h )
find_package(KF5 REQUIRED COMPONENTS Notifications KIO)
set(kdeconnect_sftp_SRCS
mounter.cpp
mountloop.cpp

View file

@ -1,5 +1,3 @@
find_package(KF5 REQUIRED COMPONENTS Notifications KIO)
set(kdeconnect_share_SRCS
shareplugin.cpp
)

View file

@ -1,5 +1,3 @@
find_package(KF5 REQUIRED COMPONENTS Notifications)
include_directories(${CMAKE_BINARY_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../notifications/) # needed for the sendreplydialog

View file

@ -1,5 +1,4 @@
find_package(Qt5 REQUIRED COMPONENTS Test)
find_package(KF5 REQUIRED COMPONENTS KIO Notifications IconThemes)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Test)
include_directories(
${KDEConnectCore_BINARY_DIR}