Skip to content
Permalink
Browse files

Cleanups

  • Loading branch information
nyalldawson committed Mar 22, 2021
1 parent 7f88aca commit d525439ccc0783572db2d0882e7786f19bbce391
Showing with 14 additions and 49 deletions.
  1. +14 −49 CMakeLists.txt
@@ -436,67 +436,41 @@ if(WITH_CORE)
set (WITH_QT6 FALSE CACHE BOOL "Enable (broken, experimental) Qt6 support")
if (WITH_QT6)
set(QT_MIN_VERSION 6.0.0)
set(QT_VERSION_BASE "Qt6")
else()
set(QT_MIN_VERSION 5.12.0)
set(QT_VERSION_BASE "Qt5")
endif()

# Use Qt5SerialPort optionally for GPS
set (WITH_QT5SERIALPORT TRUE CACHE BOOL "Determines whether Qt5SerialPort should be tried for GPS positioning")
if (WITH_QT5SERIALPORT)
if (WITH_QT6)
find_package(Qt6 COMPONENTS SerialPort REQUIRED)
else()
find_package(Qt5 COMPONENTS SerialPort REQUIRED)
endif()
find_package(${QT_VERSION_BASE} COMPONENTS SerialPort REQUIRED)
# following variable is used in qgsconfig.h
set (HAVE_QT5SERIALPORT TRUE)
endif()

if (WITH_QT6)
find_package(Qt6 COMPONENTS Core Gui Widgets Network Xml Svg Concurrent Test UiTools Sql REQUIRED)
else()
find_package(Qt5 COMPONENTS Core Gui Widgets Network Xml Svg Concurrent Test UiTools Sql REQUIRED)
endif()
find_package(${QT_VERSION_BASE} COMPONENTS Core Gui Widgets Network Xml Svg Concurrent Test UiTools Sql REQUIRED)
if (NOT IOS)
if (WITH_QT6)
find_package(Qt6 COMPONENTS PrintSupport REQUIRED)
else()
find_package(Qt5 COMPONENTS PrintSupport REQUIRED)
endif()
find_package(${QT_VERSION_BASE} COMPONENTS PrintSupport REQUIRED)
else()
add_definitions(-DQT_NO_PRINTER)
endif()
if (WITH_QT6)
find_package(Qt6 COMPONENTS Positioning)
else()
find_package(Qt5 COMPONENTS Positioning)
endif()
find_package(${QT_VERSION_BASE} COMPONENTS Positioning)
if (WITH_QTWEBKIT AND NOT WITH_QT6)
find_package(Qt5WebKit REQUIRED)
find_package(Qt5WebKitWidgets REQUIRED)
endif()
if (WITH_3D)
if (WITH_QT6)
find_package(Qt6 COMPONENTS 3DCore 3DRender 3DInput 3DLogic 3DExtras REQUIRED)
else()
find_package(Qt5 COMPONENTS 3DCore 3DRender 3DInput 3DLogic 3DExtras REQUIRED)
endif()
find_package(${QT_VERSION_BASE} COMPONENTS 3DCore 3DRender 3DInput 3DLogic 3DExtras REQUIRED)
set(HAVE_3D TRUE) # used in qgsconfig.h
endif()
if (APPLE)
if (WITH_QT6)
find_package(Qt6 COMPONENTS MacExtras REQUIRED)
else()
find_package(Qt6 COMPONENTS MacExtras REQUIRED)
endif()
find_package(${QT_VERSION_BASE} COMPONENTS MacExtras REQUIRED)
endif()

# get the Qt plugins directory
if (WITH_QT6)
get_target_property(QMAKE_EXECUTABLE Qt6::qmake LOCATION)
else()
get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION)
endif()
get_target_property(QMAKE_EXECUTABLE ${QT_VERSION_BASE}::qmake LOCATION)

EXEC_PROGRAM(${QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_PLUGINS" RETURN_VALUE return_code OUTPUT_VARIABLE DEFAULT_QT_PLUGINS_DIR )
set (QT_PLUGINS_DIR ${DEFAULT_QT_PLUGINS_DIR} CACHE STRING "Path to installation directory for Qt Plugins. Defaults to Qt native plugin directory")
@@ -507,20 +481,11 @@ if(WITH_CORE)
message(STATUS "Found Qt version: ${Qt5Core_VERSION_STRING}")
endif()
if (WITH_QUICK)
if (WITH_QT6)
find_package(Qt6 COMPONENTS Qml Quick REQUIRED)
if(${CMAKE_SYSTEM_NAME} MATCHES "Android")
find_package(Qt6 COMPONENTS AndroidExtras)
else()
find_package(QtQmlTools)
endif()
find_package(${QT_VERSION_BASE} COMPONENTS Qml Quick REQUIRED)
if(${CMAKE_SYSTEM_NAME} MATCHES "Android")
find_package(${QT_VERSION_BASE} COMPONENTS AndroidExtras)
else()
find_package(Qt5 COMPONENTS Qml Quick REQUIRED)
if(${CMAKE_SYSTEM_NAME} MATCHES "Android")
find_package(Qt5 COMPONENTS AndroidExtras)
else()
find_package(QtQmlTools)
endif()
find_package(QtQmlTools)
endif()

# following variable is used in qgsconfig.h
@@ -977,7 +942,7 @@ endif()
#############################################################
# Python bindings

if (WITH_CORE AND WITH_BINDINGS)
if (WITH_CORE AND WITH_BINDINGS AND NOT WITH_QT6)
# python support: check for interpreter, sip, pyqt5
find_package(PyQt5 REQUIRED)
set(PYQT_SIP_FLAGS ${PYQT5_SIP_FLAGS})

0 comments on commit d525439

Please sign in to comment.