From a3a25e4af9ad95162e1c30de13b28a17f3a4e6d2 Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Sun, 23 Mar 2014 16:11:11 +0100 Subject: [PATCH] make it possible to coinstall qt4 and qt5 version --- CMakeLists.txt | 17 +++++++++++++---- cmake/modules/NoKDE.cmake | 5 +---- src/CMakeLists.txt | 2 +- src/core/CMakeLists.txt | 2 +- src/core/plugins/plugincontainer.cpp | 6 +++--- src/plugins/CMakeLists.txt | 2 +- src/plugins/backends/snarl/snarl.cpp | 1 - 7 files changed, 20 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c306ef9..b7ce6da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,13 +14,14 @@ option(WITH_FRONTENDS "Build frontends currently only useful if WITH_SNORE_DEAM option(WITH_FREEDESKTOP_FRONTEND "Build the freedesktop frontend" OFF) option(WITH_GROWL_BACKEND "Build the Growl backend" ON) option(WITH_SNORE_DEAMON "Build the Snore deamon, which redirects notifications" OFF) +option(WITH_QT4 "Use Qt4" ON) ####################################################################### set(SNORE_VERSION_MAJOR 0) set(SNORE_VERSION_MINOR 5) set(SNORE_VERSION_SUFFIX "pre") -if(WITH_KDE) +if(WITH_QT4 AND WITH_KDE) find_package(KDE4) endif() @@ -28,12 +29,20 @@ if(WITH_SNORE_DEAMON) set(WITH_FRONTENDS ON) endif() +set(SNORE_SUFFIX "") if(KDE4_FOUND) add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS} -D_UNICODE) include_directories(${KDE4_INCLUDES}) -else(KDE4_FOUND) +else() + if(NOT WITH_QT4) + find_package(Qt5Transitional) + set(SNORE_SUFFIX "-qt5") + else() + find_package(Qt4 REQUIRED) + endif() + include_directories( ${QT_INCLUDES} ) include(NoKDE) -endif(KDE4_FOUND) +endif() find_package( CryptoPP ) @@ -56,7 +65,7 @@ endif(DOXYGEN_FOUND) set(LIBSNORE_PLUGIN_PATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libsnore) set(SNORE_PLUGIN_INSTALL_PATH LIBRARY DESTINATION ${LIBSNORE_PLUGIN_PATH}) -add_definitions(-DLIBSNORE_PLUGIN_PATH="${LIBSNORE_PLUGIN_PATH}") +add_definitions(-DLIBSNORE_PLUGIN_PATH="${LIBSNORE_PLUGIN_PATH}" -DSNORE_SUFFIX="${SNORE_SUFFIX}") message(STATUS "Installing plugins to ${LIBSNORE_PLUGIN_PATH}") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/cmake/modules/NoKDE.cmake b/cmake/modules/NoKDE.cmake index 21401e6..4230bb7 100644 --- a/cmake/modules/NoKDE.cmake +++ b/cmake/modules/NoKDE.cmake @@ -1,6 +1,3 @@ -find_package(Qt5Transitional) -include_directories( ${QT_INCLUDES} ) - if (CMAKE_COMPILER_IS_GNUCXX) set (KDE4_ENABLE_EXCEPTIONS -fexceptions) # Select flags. @@ -31,4 +28,4 @@ endif() if(WIN32) add_definitions(-DQT_NO_DEBUG -DQT_FORCE_ASSERTS) -endif() \ No newline at end of file +endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0eb267b..ea41eee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,7 +4,7 @@ add_subdirectory(core) if(WITH_SNORE_DEAMON) add_executable( snorenotify WIN32 main.cpp snorenotify.cpp trayicon.cpp ${SNORENOTIFY_DEAMON_DEPS}) - + set_target_properties(snorenotify PROPERTIES OUTPUT_NAME "snorenotify${SNORE_SUFFIX}") target_link_libraries( snorenotify snorecore ${QT_QTGUI_LIBRARY} ) if(KDE4_FOUND) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index cdfe131..100b47c 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -37,7 +37,7 @@ set ( SnoreNotify_HDR ${SnoreNotify_HDR} ) add_library( snorecore SHARED ${SnoreNotify_SRCS}) -set_target_properties( snorecore PROPERTIES OUTPUT_NAME "snore" DEFINE_SYMBOL "SNORECORE_DLL" ) +set_target_properties( snorecore PROPERTIES OUTPUT_NAME "snore${SNORE_SUFFIX}" DEFINE_SYMBOL "SNORECORE_DLL" ) target_link_libraries ( snorecore ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTNETWORK_LIBRARY} ) diff --git a/src/core/plugins/plugincontainer.cpp b/src/core/plugins/plugincontainer.cpp index f568e65..96dbb5a 100644 --- a/src/core/plugins/plugincontainer.cpp +++ b/src/core/plugins/plugincontainer.cpp @@ -239,9 +239,9 @@ const QDir &PluginContainer::pluginDir() } #endif list << appDir - << QString("%1/../lib/libsnore").arg(appDir) - << QString("%1/../lib64/libsnore").arg(appDir) - << QLatin1String(LIBSNORE_PLUGIN_PATH); + << QString("%1/../lib/libsnore" SNORE_SUFFIX).arg(appDir) + << QString("%1/../lib64/libsnore" SNORE_SUFFIX).arg(appDir) + << QLatin1String(LIBSNORE_PLUGIN_PATH SNORE_SUFFIX); foreach(const QString &p, list) { QDir dir(p); diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 8c4f145..7ea31e5 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -1,5 +1,5 @@ set(CMAKE_SHARED_MODULE_PREFIX) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/libsnore) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/libsnore${SNORE_SUFFIX}") add_subdirectory(backends) add_subdirectory(frontends) diff --git a/src/plugins/backends/snarl/snarl.cpp b/src/plugins/backends/snarl/snarl.cpp index 09b99ed..3faaac3 100644 --- a/src/plugins/backends/snarl/snarl.cpp +++ b/src/plugins/backends/snarl/snarl.cpp @@ -25,7 +25,6 @@ #include "core/plugins/snorebackend.h" #include "core/notification/notification_p.h" -#include #include #include