nextcloud-desktop/cmake/modules/QtVersionAbstraction.cmake

105 lines
2.6 KiB
CMake
Raw Normal View History

# (c) 2014 Copyright ownCloud GmbH
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
include (MacroOptionalFindPackage)
include (MacroLogFeature)
2017-04-13 14:02:00 +03:00
find_package(Qt5Core REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Xml REQUIRED)
find_package(Qt5Concurrent REQUIRED)
if(UNIT_TESTING)
find_package(Qt5Test REQUIRED)
endif()
if(NOT TOKEN_AUTH_ONLY)
find_package(Qt5Widgets REQUIRED)
if(APPLE)
find_package(Qt5MacExtras REQUIRED)
endif(APPLE)
if(NOT NO_SHIBBOLETH)
find_package(Qt5WebKitWidgets)
find_package(Qt5WebKit)
if(NOT Qt5WebKitWidgets_FOUND)
message(FATAL_ERROR "Qt5WebKit required for Shibboleth. Use -DNO_SHIBBOLETH=1 to disable it.")
endif()
2014-04-06 21:34:56 +04:00
endif()
2017-04-13 14:02:00 +03:00
endif()
2014-06-16 17:34:46 +04:00
2017-04-13 14:02:00 +03:00
# We need this to find the paths to qdbusxml2cpp and co
if (WITH_DBUS)
find_package(Qt5DBus REQUIRED)
include_directories(${Qt5DBus_INCLUDES})
add_definitions(${Qt5DBus_DEFINITIONS})
endif (WITH_DBUS)
include_directories(${Qt5Core_INCLUDES})
add_definitions(${Qt5Core_DEFINITIONS})
if (NOT WIN32) #implied on Win32
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif(NOT WIN32)
2013-09-05 19:08:05 +04:00
# set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
2013-08-28 22:58:22 +04:00
2017-04-13 14:02:00 +03:00
if(APPLE AND NOT TOKEN_AUTH_ONLY)
include_directories(${Qt5MacExtras_INCLUDE_DIRS})
add_definitions(${Qt5MacExtras_DEFINITIONS})
set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5MacExtras_LIBRARIES})
endif()
2013-08-28 22:58:22 +04:00
2014-04-06 21:34:56 +04:00
if(NOT BUILD_LIBRARIES_ONLY)
2014-04-07 19:38:30 +04:00
macro(qt_wrap_ui)
2014-04-08 14:08:01 +04:00
qt5_wrap_ui(${ARGN})
2014-04-07 19:38:30 +04:00
endmacro()
2014-04-06 21:34:56 +04:00
else()
# hack
SET(QT_UIC_EXECUTABLE "")
endif()
2017-04-13 14:02:00 +03:00
macro(qt_add_resources)
qt5_add_resources(${ARGN})
endmacro()
if(NOT TOKEN_AUTH_ONLY)
find_package(Qt5LinguistTools)
if(Qt5LinguistTools_FOUND)
macro(qt_add_translation)
qt5_add_translation(${ARGN})
endmacro()
else()
macro(qt_add_translation)
endmacro()
endif()
else()
macro(qt_add_translation)
endmacro()
endif()
2017-04-13 14:02:00 +03:00
macro(qt_add_dbus_interface)
qt5_add_dbus_interface(${ARGN})
endmacro()
2013-08-28 22:14:40 +04:00
2017-04-13 14:02:00 +03:00
macro(qt_add_dbus_adaptor)
qt5_add_dbus_adaptor(${ARGN})
endmacro()
2017-04-13 14:02:00 +03:00
macro(qt_wrap_cpp)
qt5_wrap_cpp(${ARGN})
endmacro()
2013-08-28 22:58:22 +04:00
2017-04-13 14:02:00 +03:00
macro(install_qt_executable)
install_qt5_executable(${ARGN})
endmacro()
2017-04-13 14:02:00 +03:00
macro(setup_qt)
endmacro()
2014-04-07 19:38:30 +04:00
2017-04-13 14:02:00 +03:00
set(QT_RCC_EXECUTABLE "${Qt5Core_RCC_EXECUTABLE}")
2017-04-13 14:02:00 +03:00
#Enable deprecated symbols
add_definitions("-DQT_DISABLE_DEPRECATED_BEFORE=0")
2017-04-13 14:02:00 +03:00
add_definitions("-DQT_USE_QSTRINGBUILDER") #optimize string concatenation
add_definitions("-DQT_MESSAGELOGCONTEXT") #enable function name and line number in debug output