From d9b7820f355ab76075aab0c7a4d3627ce6188fb4 Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Wed, 13 Mar 2013 11:15:48 +0100 Subject: [PATCH] buildsystem fixes --- CMakeLists.txt | 4 +- cmake/modules/FindAutomoc4.cmake | 81 ------------------- cmake/modules/NoKDE.cmake | 1 - src/CMakeLists.txt | 2 +- src/core/CMakeLists.txt | 2 +- src/core/snore_exports.h | 14 +++- .../backends/freedesktop/CMakeLists.txt | 2 +- src/plugins/backends/growl/CMakeLists.txt | 2 +- src/plugins/backends/snarl/CMakeLists.txt | 2 +- src/plugins/backends/trayicon/CMakeLists.txt | 2 +- .../frontends/freedesktop/CMakeLists.txt | 2 +- .../frontends/snarlnetwork/CMakeLists.txt | 2 +- 12 files changed, 24 insertions(+), 92 deletions(-) delete mode 100644 cmake/modules/FindAutomoc4.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index be3800a..9ea0e41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ project( SnoreNotify ) -cmake_minimum_required( VERSION 2.8 ) +cmake_minimum_required( VERSION 2.8.8 ) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_PREFIX_PATH}/share/apps/cmake/modules) +set(CMAKE_AUTOMOC TRUE) ####################################################################### option(WITH_FREEDESKTOP_FRONTEND "Build the freedesktop frontend" OFF) @@ -8,6 +9,7 @@ option(WITH_GROWL_BACKEND "Build the Growl backend" ON) ####################################################################### + set(CMAKE_INCLUDE_CURRENT_DIR ON) find_package(KDE4) diff --git a/cmake/modules/FindAutomoc4.cmake b/cmake/modules/FindAutomoc4.cmake deleted file mode 100644 index 86baf8d..0000000 --- a/cmake/modules/FindAutomoc4.cmake +++ /dev/null @@ -1,81 +0,0 @@ -# - Try to find automoc4 -# Once done this will define -# -# AUTOMOC4_FOUND - automoc4 has been found -# AUTOMOC4_EXECUTABLE - the automoc4 tool -# AUTOMOC4_VERSION - the full version of automoc4 -# AUTOMOC4_VERSION_MAJOR, AUTOMOC4_VERSION_MINOR, AUTOMOC4_VERSION_PATCH - AUTOMOC4_VERSION -# broken into its components -# -# It also adds the following macros -# AUTOMOC4( ) -# Use this to run automoc4 on all files contained in the list . -# -# AUTOMOC4_MOC_HEADERS( header1.h header2.h ...) -# Use this to add more header files to be processed with automoc4. -# -# AUTOMOC4_ADD_EXECUTABLE( src1 src2 ...) -# This macro does the same as ADD_EXECUTABLE, but additionally -# adds automoc4 handling for all source files. -# -# AUTOMOC4_ADD_LIBRARY( src1 src2 ...) -# This macro does the same as ADD_LIBRARY, but additionally -# adds automoc4 handling for all source files. - -# Internal helper macro, may change or be removed anytime: -# _ADD_AUTOMOC4_TARGET( ) -# -# Since version 0.9.88: -# The following two macros are only to be used for KDE4 projects -# and do something which makes sure automoc4 works for KDE. Don't -# use them anywhere else. -# _AUTOMOC4_KDE4_PRE_TARGET_HANDLING( ) -# _AUTOMOC4_KDE4_POST_TARGET_HANDLING() - - -# Copyright (c) 2008-2009, Alexander Neundorf, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -# check if we are inside KDESupport and automoc is enabled -if("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") - # when building this project as part of kdesupport - set(AUTOMOC4_CONFIG_FILE "${KDESupport_SOURCE_DIR}/automoc/Automoc4Config.cmake") -else("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") - # when building this project outside kdesupport - - # CMAKE_[SYSTEM_]PREFIX_PATH exists starting with cmake 2.6.0 - file(TO_CMAKE_PATH "$ENV{CMAKE_PREFIX_PATH}" _env_CMAKE_PREFIX_PATH) - file(TO_CMAKE_PATH "$ENV{CMAKE_LIBRARY_PATH}" _env_CMAKE_LIBRARY_PATH) - - find_file(AUTOMOC4_CONFIG_FILE NAMES Automoc4Config.cmake - PATH_SUFFIXES automoc4 lib/automoc4 lib64/automoc4 - PATHS ${_env_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH} ${CMAKE_SYSTEM_PREFIX_PATH} - ${_env_CMAKE_LIBRARY_PATH} ${CMAKE_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH} - ${CMAKE_INSTALL_PREFIX} - NO_DEFAULT_PATH ) -endif("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") - - -if(AUTOMOC4_CONFIG_FILE) - include(${AUTOMOC4_CONFIG_FILE}) - set(AUTOMOC4_FOUND TRUE) -else(AUTOMOC4_CONFIG_FILE) - set(AUTOMOC4_FOUND FALSE) -endif(AUTOMOC4_CONFIG_FILE) - -if (AUTOMOC4_FOUND) - if (NOT Automoc4_FIND_QUIETLY) - message(STATUS "Found Automoc4: ${AUTOMOC4_EXECUTABLE}") - endif (NOT Automoc4_FIND_QUIETLY) -else (AUTOMOC4_FOUND) - if (Automoc4_FIND_REQUIRED) - message(FATAL_ERROR "Did not find automoc4 (part of kdesupport).") - else (Automoc4_FIND_REQUIRED) - if (NOT Automoc4_FIND_QUIETLY) - message(STATUS "Did not find automoc4 (part of kdesupport).") - endif (NOT Automoc4_FIND_QUIETLY) - endif (Automoc4_FIND_REQUIRED) -endif (AUTOMOC4_FOUND) diff --git a/cmake/modules/NoKDE.cmake b/cmake/modules/NoKDE.cmake index 3d555ec..da7fe1d 100644 --- a/cmake/modules/NoKDE.cmake +++ b/cmake/modules/NoKDE.cmake @@ -1,5 +1,4 @@ find_package( Qt4 REQUIRED ) -find_package( Automoc4 REQUIRED) include_directories( ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTNETWORK_INCLUDE_DIR}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1583163..19d970a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,7 +10,7 @@ else(WIN32) set(WIN32_SPECIFIC) endif(WIN32) -automoc4_add_executable( snorenotify ${WIN32_SPECIFIC} main.cpp snorenotify.cpp trayicon.cpp ${SNORENOTIFY_DEPS}) +add_executable( snorenotify ${WIN32_SPECIFIC} main.cpp snorenotify.cpp trayicon.cpp ${SNORENOTIFY_DEPS}) target_link_libraries( snorenotify snorecore ${QT_QTGUI_LIBRARY} ) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index aaeb63c..bd561b3 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -26,7 +26,7 @@ set ( SnoreNotify_HDR ${SnoreNotify_HDR} version.h ) -automoc4_add_library( snorecore SHARED ${SnoreNotify_SRCS}) +add_library( snorecore SHARED ${SnoreNotify_SRCS}) set_target_properties( snorecore PROPERTIES OUTPUT_NAME "snore" DEFINE_SYMBOL "SNORECORE_DLL" ) target_link_libraries ( snorecore ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ) diff --git a/src/core/snore_exports.h b/src/core/snore_exports.h index a28a3ab..e926b35 100644 --- a/src/core/snore_exports.h +++ b/src/core/snore_exports.h @@ -1,12 +1,24 @@ #ifndef SNORE_EXPORT_H #define SNORE_EXPORT_H -#include + +#if defined(HAVE_KDE) +#include +#ifdef SNORECORE_DLL +# define SNORE_EXPORT KDE_EXPORT +#else +# define SNORE_EXPORT KDE_IMPORT +#endif +#else +#include #ifdef SNORECORE_DLL # define SNORE_EXPORT Q_DECL_EXPORT #else # define SNORE_EXPORT Q_DECL_IMPORT #endif +#endif + + #ifndef SNORE_DEPRECATED # ifdef Q_CC_GNU diff --git a/src/plugins/backends/freedesktop/CMakeLists.txt b/src/plugins/backends/freedesktop/CMakeLists.txt index 82e7b8c..70ad08a 100644 --- a/src/plugins/backends/freedesktop/CMakeLists.txt +++ b/src/plugins/backends/freedesktop/CMakeLists.txt @@ -4,7 +4,7 @@ if(QT_QTDBUS_FOUND AND NOT WITH_FREEDESKTOP_FRONTEND AND UNIX AND NOT APPLE) freedesktopnotification_backend.cpp fredesktopnotification.cpp ) - automoc4_add_library(freedesktop_backend MODULE ${FREEDESKTOP_NOTIFICATION_SRC} ) + add_library(freedesktop_backend MODULE ${FREEDESKTOP_NOTIFICATION_SRC} ) target_link_libraries(freedesktop_backend snorecore ${QT_QTGUI_LIBRARY} ${QT_QTDBUS_LIBRARY} ) install(TARGETS freedesktop_backend ${SNORE_BACKEND_INSTALL_PATH}) diff --git a/src/plugins/backends/growl/CMakeLists.txt b/src/plugins/backends/growl/CMakeLists.txt index c86c379..d692784 100644 --- a/src/plugins/backends/growl/CMakeLists.txt +++ b/src/plugins/backends/growl/CMakeLists.txt @@ -8,7 +8,7 @@ if( WITH_GROWL_BACKEND ) growl.cpp ) - automoc4_add_library(growl MODULE ${GROWL__SRC} ) + add_library(growl MODULE ${GROWL__SRC} ) target_link_libraries(growl snorecore ${QT_QTCORE_LIBRARY} ${CRYPTOPP_LIBRARIES} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY}) if(MINGW) diff --git a/src/plugins/backends/snarl/CMakeLists.txt b/src/plugins/backends/snarl/CMakeLists.txt index c4fb606..b261a13 100644 --- a/src/plugins/backends/snarl/CMakeLists.txt +++ b/src/plugins/backends/snarl/CMakeLists.txt @@ -5,7 +5,7 @@ if(WIN32) SnarlInterface.cpp snarl.cpp ) - automoc4_add_library(snarl MODULE ${SNARL_SRC} ) + add_library(snarl MODULE ${SNARL_SRC} ) target_link_libraries(snarl snorecore ${QT_QTCORE_LIBRARY} ) install(TARGETS snarl ${SNORE_BACKEND_INSTALL_PATH}) diff --git a/src/plugins/backends/trayicon/CMakeLists.txt b/src/plugins/backends/trayicon/CMakeLists.txt index efa2a5c..afa0a41 100644 --- a/src/plugins/backends/trayicon/CMakeLists.txt +++ b/src/plugins/backends/trayicon/CMakeLists.txt @@ -1,7 +1,7 @@ set( trayicon_SRC trayiconnotifer.cpp ) -automoc4_add_library(trayicon MODULE ${trayicon_SRC} ) +add_library(trayicon MODULE ${trayicon_SRC} ) target_link_libraries(trayicon snorecore ${QT_QTCORE_LIBRARY} ) install(TARGETS trayicon ${SNORE_BACKEND_INSTALL_PATH}) diff --git a/src/plugins/frontends/freedesktop/CMakeLists.txt b/src/plugins/frontends/freedesktop/CMakeLists.txt index fc4546b..7363cba 100644 --- a/src/plugins/frontends/freedesktop/CMakeLists.txt +++ b/src/plugins/frontends/freedesktop/CMakeLists.txt @@ -8,7 +8,7 @@ if(QT_QTDBUS_FOUND AND WITH_FREEDESKTOP_FRONTEND) qt4_add_dbus_adaptor( FREEDESKTOP_NOTIFICATION_FRONTEND_SRC org.freedesktop.Notifications.xml freedesktopnotificationfrontend.h FreedesktopFrontend) - automoc4_add_library(freedesktop MODULE ${FREEDESKTOP_NOTIFICATION_FRONTEND_SRC} ) + add_library(freedesktop MODULE ${FREEDESKTOP_NOTIFICATION_FRONTEND_SRC} ) target_link_libraries(freedesktop snorecore ${QT_QTDBUS_LIBRARY} ${QT_QTGUI_LIBRARY} ) if(KDE4_FOUND) diff --git a/src/plugins/frontends/snarlnetwork/CMakeLists.txt b/src/plugins/frontends/snarlnetwork/CMakeLists.txt index 3bd39f1..dacfdfa 100644 --- a/src/plugins/frontends/snarlnetwork/CMakeLists.txt +++ b/src/plugins/frontends/snarlnetwork/CMakeLists.txt @@ -3,7 +3,7 @@ set( SNARL_NETWORK_SRC snarlnetwork.cpp parser.cpp ) -automoc4_add_library(snarlnetwork MODULE ${SNARL_NETWORK_SRC} ) +add_library(snarlnetwork MODULE ${SNARL_NETWORK_SRC} ) target_link_libraries(snarlnetwork snorecore ${QT_QTNETWORK_LIBRARY} ) install(TARGETS snarlnetwork ${SNORE_FRONTEND_INSTALL_PATH})