From d6b21e20e254c96d963c6ab4988ad635f8f4e44b Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Sat, 9 Jun 2018 16:52:15 +0200 Subject: [PATCH] Cmake build: Adapt to compile with qt5.11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since qt5_use_modules() is removed from QT5 (as spotted by Jürgen Spitzmüller), we had to create own version of this macro. --- CMakeLists.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 790dfdaeaf..8403934eb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -657,8 +657,19 @@ if(LYX_USE_QT MATCHES "QT5") # Subject: cmake compilation error #message(FATAL_ERROR "Wrong Qt-Version") endif() - macro (qt_use_modules) - qt5_use_modules(${ARGN}) + macro (qt_use_modules lyxtarget) + if (Qt5_POSITION_INDEPENDENT_CODE + AND (CMAKE_VERSION VERSION_LESS 2.8.12 + AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))) + set_property(TARGET ${lyxtarget} PROPERTY POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE}) + endif() + foreach (_tg ${ARGN}) + find_package(Qt5${_tg} REQUIRED) + include_directories(${Qt5${_tg}_INCLUDE_DIRS}) + set_property(TARGET ${lyxtarget} APPEND PROPERTY COMPILE_DEFINITIONS ${Qt5${_tg}_COMPILE_DEFINITIONS}) + target_link_libraries(${lyxtarget} ${Qt5${_tg}_LIBRARIES}) + endforeach() endmacro() macro (qt_add_resources) qt5_add_resources(${ARGN})