Commit 25f18832 authored by Urs Fleisch's avatar Urs Fleisch
Browse files

Support build with Qt5.

parent f41b4e4d
......@@ -105,13 +105,48 @@ set(CFG_DOCDIR ${CMAKE_INSTALL_PREFIX_SLASH}${WITH_DOCDIR})
set(CFG_TRANSLATIONSDIR ${CMAKE_INSTALL_PREFIX_SLASH}${WITH_TRANSLATIONSDIR})
cmake_minimum_required(VERSION 2.8)
set(_QT4_COMPONENTS QtCore QtGui QtNetwork QtXml)
if (WIN32)
set(QT_USE_QTMAIN TRUE)
endif (WIN32)
set(QT_USE_QTDBUS ${WITH_DBUS})
find_package(Qt4 COMPONENTS ${_QT4_COMPONENTS} REQUIRED)
include (${QT_USE_FILE})
string(REGEX MATCH "^.*qt5" _qt5Dir "${QT_QMAKE_EXECUTABLE}")
if (_qt5Dir)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(Qt5Core_DIR "${_qt5Dir}/lib/cmake/Qt5Core")
set(Qt5Gui_DIR "${_qt5Dir}/lib/cmake/Qt5Gui")
set(Qt5Widgets_DIR "${_qt5Dir}/lib/cmake/Qt5Widgets")
set(Qt5Network_DIR "${_qt5Dir}/lib/cmake/Qt5Network")
set(Qt5Xml_DIR "${_qt5Dir}/lib/cmake/Qt5Xml")
set(Qt5LinguistTools_DIR "${_qt5Dir}/lib/cmake/Qt5LinguistTools")
set(QT_INCLUDES)
set(QT_DEFINITIONS)
set(QT_LIBRARIES)
foreach (_qt5Component Core Gui Widgets Network Xml LinguistTools)
find_package("Qt5${_qt5Component}")
set(QT_INCLUDES ${QT_INCLUDES} ${Qt5${_qt5Component}_INCLUDE_DIRS})
set(QT_DEFINITIONS ${QT_DEFINITIONS} ${Qt5${_qt5Component}_DEFINITIONS})
set(QT_LIBRARIES ${QT_LIBRARIES} ${Qt5${_qt5Component}_LIBRARIES})
endforeach ()
set(QT_LIBRARY_DIR "${_qt5Dir}/lib")
set(QT_INCLUDE_DIR "${_qt5Dir}/include")
macro(qt4_add_translation)
qt5_add_translation(${ARGV})
endmacro(qt4_add_translation)
macro(qt4_wrap_cpp)
qt5_wrap_cpp(${ARGV})
endmacro(qt4_wrap_cpp)
macro(qt4_add_resources)
qt5_add_resources(${ARGV})
endmacro(qt4_add_resources)
else (_qt5Dir)
set(_QT4_COMPONENTS QtCore QtGui QtNetwork QtXml)
if (WIN32)
set(QT_USE_QTMAIN TRUE)
endif (WIN32)
set(QT_USE_QTDBUS ${WITH_DBUS})
find_package(Qt4 COMPONENTS ${_QT4_COMPONENTS} REQUIRED)
include (${QT_USE_FILE})
endif (_qt5Dir)
include (CheckCXXSourceCompiles)
find_package(Perl REQUIRED)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment