Am Freitag, 15. Juni 2018 22:29:47 CEST schrieb Stephan Witt <[email protected]>: > Am 14.06.2018 um 19:56 schrieb Scott Kostyshak <[email protected]>: > > > > On Thu, Jun 14, 2018 at 12:05:08PM +0000, Kornel Benko wrote: > >> Am Mittwoch, 13. Juni 2018 14:52:43 CEST schrieb Scott Kostyshak > >> <[email protected]>: > >>>> It is possible, the commit d6b21e2 does exactly that. Does not raise the > >>>> minimal cmake version, instead > >>>> it copies some statements from original qt5_use_modules() into our > >>>> cmake-handling. > >>> > >>> Ah good to know. So that would be option 1. Why do you prefer option 2? > >>> Perhaps 3.1.0 is old enough that you don't think requiring it will > >>> affect many people? > >>> > >> > >> Yes, that is the idea. > > > > Fine with me then. Unless Stephan disagrees (I can't tell, maybe wait > > for clarification by seeing his response to Jürgen's recent response?), > > I would say go with option 2 since you prefer that one. > > I don’t have tried any of the offered options. ATM I don’t have a problem > to build 2.3.x. And on Mac I’ll stick to stable Qt 5.9 until Qt 5.12 is > available if possible. > > I tried to cherry-pick d6b21e2 72a2f92 6343452 cb08d4a 1bf4d7b (to check > option 2) but got a conflict with 72a2f92 - what did I wrong?
Nothing. I experienced the same conflict. The diff is not exactly at the same
source line,
and that may add to confuse the merging.
Had to do it manually.
> Stephan
Anyway, the attached should apply.
Kornel
commit 629cc6c6483d7711e8879d09ed09d422b6ed3e20 Author: Kornel Benko <[email protected]> Date: Thu Jun 14 13:55:52 2018 +0200 Cmake build: Adapt to compile with qt5.11 Since qt5_use_modules() is removed from QT5 (as spotted by Jürgen Spitzmüller), we had to create own version of this macro. According to this page: http://doc.qt.io/qt-5/cmake-manual.html the way to replace use of qt5_use_modules() for module "_mod" and target "_target" is to use 1.) cmake_minimum_required(VERSION 3.1.0) 2.) find_package(Qt5${_mod} CONFIG REQUIRED) 3.) target_link_libraries(${_target} Qt5::${_mod}) The last one sets all reguired libraries, compile flags and needed includes for the ${_target} Disable possible warn about not known policy Extend Clang compiler detection to cover Apple CLang (cherry picked from commit d6b21e20e254c96d963c6ab4988ad635f8f4e44b) (cherry picked from commit 72a2f922393f8029b658fffe3c5a2e3e2c81ac1d) (cherry picked from commit 6343452a7397a5ac4b84af30d61c4d7fca5afbc1) (cherry picked from commit cb08d4a879bf63222a4462308b614d3209607737) (cherry picked from commit 1bf4d7b0fc2bc4c700e7cecc1e6e3c7faf4f03a5) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3c05d4..ed0f4a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,11 +2,11 @@ # Licence details can be found in the file COPYING. # # Copyright (c) 2006-2011 Peter Kümmel, <[email protected]> # Copyright (c) 2008-2011 Kornel Benko, <[email protected]> -cmake_minimum_required(VERSION 2.6.4) +cmake_minimum_required(VERSION 3.1.0) set(LYX_PROJECT LyX) # Instruct cmake to not use gnu extensions, # this prevents the mix of '-std=c++*' and '-std=gnu++*' flags @@ -45,10 +45,14 @@ if(COMMAND cmake_policy) cmake_policy(SET CMP0006 NEW) if(POLICY CMP0043) # COMPILE_DEFINITIONS are not used yet. Enable new behavior. cmake_policy(SET CMP0043 NEW) endif() + cmake_policy(SET CMP0020 NEW) + if(POLICY CMP0075) + cmake_policy(SET CMP0075 OLD) + endif() endif() set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) # Supress regeneration @@ -258,11 +262,11 @@ find_package(CXX11Compiler) if(NOT CXX11COMPILER_FOUND) message(FATAL_ERROR "A C++11 compatible compiler is required.") endif() set(LYX_GCC11_MODE) if(UNIX OR MINGW) - if (CMAKE_CXX_COMPILER_ID MATCHES "^[cC]lang$") + if (CMAKE_CXX_COMPILER_ID MATCHES "^([cC]lang|AppleClang)$") # ignore the GCC_VERSION for clang # and use the resulting CXX11_STD_REGEX found in FindCXX11Compiler.cmake message(STATUS "Using clang") if(CXX11_STD_REGEX) set(LYX_USE_STD_REGEX 1) @@ -623,11 +627,11 @@ if(LYX_XMINGW) endif() set(min_qt5_version "5.6") if(LYX_USE_QT MATCHES "AUTO") # try qt5 first - find_package(Qt5Core QUIET) + find_package(Qt5Core CONFIG QUIET) if(Qt5Core_FOUND) set(LYX_USE_QT "QT5" CACHE STRING "Valid qt version" FORCE) message(STATUS "Qt5Core_VERSION = ${Qt5Core_VERSION}") if(Qt5Core_VERSION VERSION_LESS ${min_qt5_version}) find_package(Qt4 "4.5.0" QUIET) @@ -639,18 +643,18 @@ if(LYX_USE_QT MATCHES "AUTO") set(LYX_USE_QT "QT4" CACHE STRING "Valid qt version" FORCE) endif() endif() if(LYX_USE_QT MATCHES "QT5") # set QPA_XCB if QT uses X11 - find_package(Qt5Core REQUIRED) + find_package(Qt5Core CONFIG REQUIRED) if (Qt5Core_FOUND) - find_package(Qt5Widgets REQUIRED) + find_package(Qt5Widgets CONFIG REQUIRED) if(APPLE) - find_package(Qt5MacExtras REQUIRED) + find_package(Qt5MacExtras CONFIG REQUIRED) endif() - find_package(Qt5X11Extras QUIET) - find_package(Qt5WinExtras QUIET) + find_package(Qt5X11Extras CONFIG QUIET) + find_package(Qt5WinExtras CONFIG QUIET) set(QTVERSION ${Qt5Core_VERSION}) if (QTVERSION VERSION_LESS ${min_qt5_version}) message(STATUS "QTVERSION = \"${QTVERSION}\"") message(STATUS "This version is not recommended, try either option -DLYX_USE_QT=QT4 or") message(STATUS "install QT-Version >= \"${min_qt5_version}\"") @@ -658,12 +662,15 @@ if(LYX_USE_QT MATCHES "QT5") # From: Jean-Pierre Chrétien <[email protected]> # Date 11.03.2017 # Subject: cmake compilation error #message(FATAL_ERROR "Wrong Qt-Version") endif() - macro (qt_use_modules) - qt5_use_modules(${ARGN}) + macro (qt_use_modules lyxtarget) + foreach (_tg ${ARGN}) + find_package(Qt5${_tg} CONFIG REQUIRED) + target_link_libraries(${lyxtarget} Qt5::${_tg}) + endforeach() endmacro() macro (qt_add_resources) qt5_add_resources(${ARGN}) endmacro() macro (qt_wrap_uifiles) @@ -696,11 +703,11 @@ else() message(FATAL_ERROR "Unhandled value for LYX_USE_QT (${LYX_USE_QT})") endif() find_package(Magic) if(Magic_FOUND) - set(HAVE_MAGIC_H 1) + set(HAVE_MAGIC_H 1) endif() include_directories(${TOP_BINARY_DIR} ${TOP_SRC_DIR}/src) set(Spelling_FOUND OFF) diff --git a/INSTALL.cmake b/INSTALL.cmake index 4c8d478..540b68e 100644 --- a/INSTALL.cmake +++ b/INSTALL.cmake @@ -1,10 +1,10 @@ ========================= Building LyX with CMake ========================= - Install CMake from www.cmake.org or your distribution (version >= 2.6.4). + Install CMake from www.cmake.org or your distribution (version >= 3.1.0). 3rd party libraries -------------------- diff --git a/development/cmake/modules/FindCXX11Compiler.cmake b/development/cmake/modules/FindCXX11Compiler.cmake index 5c7b698..739d267 100644 --- a/development/cmake/modules/FindCXX11Compiler.cmake +++ b/development/cmake/modules/FindCXX11Compiler.cmake @@ -32,11 +32,11 @@ # INCLUDE(CheckCXXSourceCompiles) INCLUDE(FindPackageHandleStandardArgs) -if (CMAKE_CXX_COMPILER_ID MATCHES "^[cC]lang$") +if (CMAKE_CXX_COMPILER_ID MATCHES "^([cC]lang|AppleClang)$") set(CXX11_FLAG_CANDIDATES "--std=c++11 -Wno-deprecated-register") else() if (CYGWIN) set(CXX11_FLAG_CANDIDATES "--std=gnu++11") else()
signature.asc
Description: This is a digitally signed message part.
