From 497ff0429bd4ed550cc875849f8d07c33abde1fd Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Fri, 17 Oct 2014 18:07:22 +0200 Subject: [PATCH] made dependency on KF5::FrameworkIntegration optional --- kstyle/CMakeLists.txt | 21 ++++++++++++++++++--- kstyle/breezestyle.cpp | 2 +- kstyle/breezestyle.h | 4 +++- kstyle/config-breeze.h.cmake | 7 +++++-- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/kstyle/CMakeLists.txt b/kstyle/CMakeLists.txt index 7d526d9c..f0b1d54c 100644 --- a/kstyle/CMakeLists.txt +++ b/kstyle/CMakeLists.txt @@ -27,6 +27,7 @@ if(BREEZE_USE_KDE4) find_package(PkgConfig REQUIRED) pkg_check_modules(XCB xcb x11-xcb) set(BREEZE_HAVE_X11 ${XCB_FOUND}) + set(BREEZE_HAVE_KSTYLE FALSE) else() @@ -34,10 +35,20 @@ else() find_package(KF5 REQUIRED COMPONENTS I18n Config - Completion - FrameworkIntegration + ConfigWidgets WindowSystem) + find_package( KF5FrameworkIntegration CONFIG ) + set_package_properties(KF5FrameworkIntegration PROPERTIES + DESCRIPTION "KF4 FrameworkIntegration framework" + URL "http://xcb.freedesktop.org" + TYPE OPTIONAL + PURPOSE "Required to use KStyle convenience functionalities in style" + ) + + set(BREEZE_HAVE_KSTYLE ${KF5FrameworkIntegration_FOUND}) + + find_package(XCB COMPONENTS XCB) set_package_properties(XCB PROPERTIES DESCRIPTION "X protocol C-language Binding" @@ -123,7 +134,11 @@ else() kconfig_add_kcfg_files(breeze_PART_SRCS breezestyleconfigdata.kcfgc) add_library(breeze MODULE ${breeze_PART_SRCS}) target_link_libraries(breeze Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus) - target_link_libraries(breeze KF5::ConfigCore KF5::ConfigWidgets KF5::GuiAddons KF5::Style KF5::WindowSystem) + target_link_libraries(breeze KF5::ConfigCore KF5::ConfigWidgets KF5::GuiAddons KF5::WindowSystem) + + if( KF5FrameworkIntegration_FOUND ) + target_link_libraries(breeze KF5::Style) + endif() if (WIN32) # As stated in http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx M_PI only gets defined diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp index cfe089e7..27d29925 100644 --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -170,7 +170,7 @@ namespace Breeze , _splitterFactory( new SplitterFactory( this ) ) , _widgetExplorer( new WidgetExplorer( this ) ) , _tabBarData( new BreezePrivate::TabBarData( this ) ) - #if !BREEZE_USE_KDE4 + #if BREEZE_HAVE_KSTYLE , SH_ArgbDndWindow( newStyleHint( QStringLiteral( "SH_ArgbDndWindow" ) ) ) , CE_CapacityBar( newControlElement( QStringLiteral( "CE_CapacityBar" ) ) ) #endif diff --git a/kstyle/breezestyle.h b/kstyle/breezestyle.h index 18250657..213a7703 100644 --- a/kstyle/breezestyle.h +++ b/kstyle/breezestyle.h @@ -23,7 +23,9 @@ #include "breeze.h" #include "config-breeze.h" +#if BREEZE_HAVE_KSTYLE #include +#endif #include #include @@ -54,7 +56,7 @@ namespace Breeze class WindowManager; //* convenience typedef for base class - #if BREEZE_USE_KDE4 + #if BREEZE_USE_KDE4 || !BREEZE_HAVE_KSTYLE using ParentStyleClass = QCommonStyle; #else using ParentStyleClass = KStyle; diff --git a/kstyle/config-breeze.h.cmake b/kstyle/config-breeze.h.cmake index 3ee3a288..ba2b5f64 100644 --- a/kstyle/config-breeze.h.cmake +++ b/kstyle/config-breeze.h.cmake @@ -22,10 +22,13 @@ #ifndef config_breeze_h #define config_breeze_h -/* Define to 1 if you compile against KDE4*/ +/* Define to 1 if breeze is compiled against KDE4 */ #cmakedefine01 BREEZE_USE_KDE4 -/* Define to 1 if you have XCB libraries */ +/* Define to 1 if FrameworkIntegration/Kstyle libraries are found */ +#cmakedefine01 BREEZE_HAVE_KSTYLE + +/* Define to 1 if XCB libraries are found */ #cmakedefine01 BREEZE_HAVE_X11 #endif