make it possible to coinstall qt4 and qt5 version

This commit is contained in:
Patrick von Reth 2014-03-23 16:11:11 +01:00
parent 5afad635c3
commit a3a25e4af9
7 changed files with 20 additions and 15 deletions

View File

@ -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)

View File

@ -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()
endif()

View File

@ -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)

View File

@ -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} )

View File

@ -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);

View File

@ -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)

View File

@ -25,7 +25,6 @@
#include "core/plugins/snorebackend.h"
#include "core/notification/notification_p.h"
#include <QtCore>
#include <QtDebug>
#include <QWidget>