mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
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 commitd6b21e20e2
) (cherry picked from commit72a2f92239
) (cherry picked from commit6343452a73
) (cherry picked from commitcb08d4a879
) (cherry picked from commit1bf4d7b0fc
)
This commit is contained in:
parent
0eccf87797
commit
889d10cda3
@ -4,7 +4,7 @@
|
||||
# Copyright (c) 2006-2011 Peter Kümmel, <syntheticpp@gmx.net>
|
||||
# Copyright (c) 2008-2011 Kornel Benko, <Kornel.Benko@berlin.de>
|
||||
|
||||
cmake_minimum_required(VERSION 2.6.4)
|
||||
cmake_minimum_required(VERSION 3.1.0)
|
||||
|
||||
set(LYX_PROJECT LyX)
|
||||
|
||||
@ -47,6 +47,10 @@ if(COMMAND cmake_policy)
|
||||
# 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)
|
||||
@ -260,7 +264,7 @@ if(NOT CXX11COMPILER_FOUND)
|
||||
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")
|
||||
@ -625,7 +629,7 @@ 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}")
|
||||
@ -641,14 +645,14 @@ if(LYX_USE_QT MATCHES "AUTO")
|
||||
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}\"")
|
||||
@ -660,8 +664,11 @@ 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)
|
||||
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})
|
||||
@ -698,7 +705,7 @@ 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)
|
||||
|
@ -2,7 +2,7 @@
|
||||
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).
|
||||
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user