-
Notifications
You must be signed in to change notification settings - Fork 65
/
package.cmake
62 lines (51 loc) · 2.04 KB
/
package.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# This file is part of Desktop App Toolkit,
# a set of libraries for developing nice desktop applications.
#
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
if (NOT DESKTOP_APP_USE_PACKAGED)
if (DEFINED ENV{QT})
set(qt_version $ENV{QT} CACHE STRING "Qt version" FORCE)
endif()
if (NOT DEFINED qt_version)
message(FATAL_ERROR "Qt version is unknown, set `QT' environment variable")
endif()
if (WIN32)
set(qt_loc ${libs_loc}/Qt-${qt_version})
elseif (APPLE)
set(qt_loc ${libs_loc}/local/Qt-${qt_version})
else()
set(qt_loc /usr/local/desktop-app/Qt-${qt_version})
endif()
set(CMAKE_PREFIX_PATH ${qt_loc})
endif()
if (NOT DEFINED QT_VERSION_MAJOR)
if (NOT WIN32)
find_package(QT NAMES Qt6 COMPONENTS Core)
endif()
if (NOT QT_FOUND)
find_package(QT NAMES Qt5 COMPONENTS Core)
endif()
if (NOT QT_FOUND)
message(FATAL_ERROR "Neither Qt6 nor Qt5 is found")
endif()
endif()
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets Network Svg REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS Quick QuickWidgets QUIET)
set(qt_version_6_5_or_greater 0)
if (QT_VERSION_MAJOR GREATER_EQUAL 6)
if (QT_VERSION_MINOR GREATER_EQUAL 5)
set(qt_version_6_5_or_greater 1)
endif()
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL OpenGLWidgets REQUIRED)
endif()
# QtWaylandScanner cmake integration from Qt 6 is used
cmake_dependent_option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration." OFF "LINUX; qt_version_6_5_or_greater" ON)
if (LINUX)
find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS DBus WaylandClient WaylandCompositor QUIET)
if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WaylandClient REQUIRED)
endif()
endif()
set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "(gen)")
set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER "(gen)")