cleanup cmkae stuff

This commit is contained in:
Patrick von Reth 2014-03-23 20:19:10 +01:00
parent ce621e5dd9
commit 489d83d0db
3 changed files with 13 additions and 90 deletions

View File

@ -1,5 +1,5 @@
project( SnoreNotify )
cmake_minimum_required( VERSION 2.8.8 )
cmake_minimum_required( VERSION 2.8.9 )
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_PREFIX_PATH}/share/apps/cmake/modules)
set(CMAKE_AUTOMOC ON)
@ -8,12 +8,13 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
cmake_policy(SET CMP0020 NEW)
include(GNUInstallDirs)
include(CMakeDependentOption)
#######################################################################
option(WITH_KDE "Try to build with KDE support if availibe" ON)
option(WITH_FRONTENDS "Build frontends currently only useful if WITH_SNORE_DEAMON=ON" OFF)
option(WITH_FREEDESKTOP_FRONTEND "Build the freedesktop frontend" OFF)
cmake_dependent_option(WITH_FREEDESKTOP_FRONTEND "Build the freedesktop frontend" OFF "WITH_SNORE_DEAMON" ON)
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)
@ -27,20 +28,20 @@ if(WITH_QT4 AND WITH_KDE)
find_package(KDE4)
endif()
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()
if(NOT WITH_QT4)
find_package(Qt5Transitional COMPONENTS Core Widgets DBus Network)
set(SNORE_SUFFIX "-qt5")
else()
if(WITH_QT4)
find_package(Qt4 REQUIRED)
else()
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5DBus)
include(ECMQt4To5Porting)
set(SNORE_SUFFIX "-qt5")
endif()
include_directories( ${QT_INCLUDES} )
include(NoKDE)
@ -61,7 +62,7 @@ if(DOXYGEN_FOUND)
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
else(DOXYGEN_FOUND)
message(WARNING "No doxygen package found")
message(STATUS "No doxygen package found")
endif(DOXYGEN_FOUND)

View File

@ -1,78 +0,0 @@
find_package(Qt5Core QUIET)
if (Qt5Core_FOUND)
set(_allComponents
Core
Gui
DBus
Designer
Declarative
Script
ScriptTools
Network
Test
Xml
Svg
Sql
Widgets
PrintSupport
Concurrent
UiTools
WebKit
WebKitWidgets
OpenGL
X11Extras
Qml
Quick
)
if (NOT Qt5Transitional_FIND_COMPONENTS)
foreach(_component ${_allComponents})
find_package(Qt5${_component})
list(APPEND QT_LIBRARIES ${Qt5${_component}_LIBRARIES})
endforeach()
else()
set(_components ${Qt5Transitional_FIND_COMPONENTS})
foreach(_component ${Qt5Transitional_FIND_COMPONENTS})
find_package(Qt5${_component} REQUIRED)
if ("${_component}" STREQUAL "WebKit")
find_package(Qt5WebKitWidgets REQUIRED)
list(APPEND QT_LIBRARIES ${Qt5WebKitWidgets_LIBRARIES} )
endif()
if ("${_component}" STREQUAL "Gui")
find_package(Qt5Widgets REQUIRED)
find_package(Qt5PrintSupport REQUIRED)
find_package(Qt5Svg REQUIRED)
list(APPEND QT_LIBRARIES ${Qt5Widgets_LIBRARIES}
${Qt5PrintSupport_LIBRARIES}
${Qt5Svg_LIBRARIES} )
endif()
if ("${_component}" STREQUAL "Core")
find_package(Qt5Concurrent REQUIRED)
list(APPEND QT_LIBRARIES ${Qt5Concurrent_LIBRARIES} )
endif()
endforeach()
endif()
set(Qt5Transitional_FOUND TRUE)
set(QT5_BUILD TRUE)
get_filename_component(_modules_dir "${CMAKE_CURRENT_LIST_DIR}/../modules" ABSOLUTE)
include("${_modules_dir}/ECMQt4To5Porting.cmake") # TODO: Port away from this.
else()
foreach(_component ${Qt5Transitional_FIND_COMPONENTS})
if("${_component}" STREQUAL "Widgets") # new in Qt5
set(_component Gui)
elseif("${_component}" STREQUAL "Concurrent") # new in Qt5
set(_component Core)
endif()
list(APPEND _components Qt${_component})
endforeach()
find_package(Qt4 ${QT_MIN_VERSION} REQUIRED ${_components})
if(QT4_FOUND)
set(Qt5Transitional_FOUND TRUE)
endif()
endif()

View File

@ -27,5 +27,5 @@ if(MINGW)
endif()
if(WIN32)
add_definitions(-DQT_NO_DEBUG -DQT_FORCE_ASSERTS)
add_definitions(-DQT_NO_DEBUG -DQT_FORCE_ASSERTS -D_WIN32_WINNT=0x0501)
endif()