diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,13 +72,13 @@ find_package(Qt5MacExtras ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) endif() if (WIN32) - find_package(LibSnoreToast REQUIRED) - set_package_properties(LibSnoreToast PROPERTIES TYPE REQUIRED - PURPOSE "for the Windows Toast Notifications" - DESCRIPTION "A command line application, capable of creating - Windows Toast notifications on Windows (>=)8 " - ) + find_package(LibSnoreToast) find_package(Qt5Network REQUIRED) + + include(CMakeDependentOption) + cmake_dependent_option(WITH_SNORETOAST "for the Windows Toast Notifications" ON + "Qt5Network_FOUND;LibSnoreToast_FOUND" OFF + ) endif() set(HAVE_KWINDOWSYSTEM FALSE) @@ -90,7 +90,7 @@ find_package(KF5Config ${KF5_DEP_VERSION} REQUIRED) find_package(KF5CoreAddons ${KF5_DEP_VERSION} REQUIRED) -if (NOT WIN32 AND NOT ANDROID) +if (NOT ANDROID OR (WIN32 AND NOT ${WITH_SNORETOAST})) find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED DBus) find_package(Canberra) set_package_properties(Canberra PROPERTIES diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,7 +43,7 @@ list(APPEND knotifications_SRCS notifybyandroid.cpp knotifications.qrc) endif() -if (WIN32) +if (WITH_SNORETOAST) list(APPEND knotifications_SRCS notifybysnore.cpp) endif () diff --git a/src/config-knotifications.h.cmake b/src/config-knotifications.h.cmake --- a/src/config-knotifications.h.cmake +++ b/src/config-knotifications.h.cmake @@ -7,3 +7,5 @@ #cmakedefine01 HAVE_DBUSMENUQT #cmakedefine01 HAVE_KWINDOWSYSTEM + +#cmakedefine WITH_SNORETOAST diff --git a/src/knotificationmanager.cpp b/src/knotificationmanager.cpp --- a/src/knotificationmanager.cpp +++ b/src/knotificationmanager.cpp @@ -21,6 +21,8 @@ #include "knotificationmanager_p.h" #include "knotification.h" +#include + #include #include #include @@ -42,7 +44,7 @@ #include "notifybyandroid.h" #elif defined(Q_OS_MACOS) #include "notifybymacosnotificationcenter.h" -#elif defined(Q_OS_WIN) +#elif defined(WITH_SNORETOAST) #include "notifybysnore.h" #else #include "notifybypopup.h" @@ -137,7 +139,7 @@ if (action == QLatin1String("Popup")) { #if defined(Q_OS_ANDROID) plugin = new NotifyByAndroid(this); -#elif defined(Q_OS_WIN) +#elif defined(WITH_SNORETOAST) plugin = new NotifyBySnore(this); #elif defined(Q_OS_MACOS) plugin = new NotifyByMacOSNotificationCenter(this);