1
0
Fork 0
cmake_helpers/external/qt/package.cmake
2024-04-22 10:59:37 +04:00

51 lines
1.6 KiB
CMake

# 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/Qt-${qt_version})
endif()
set(CMAKE_PREFIX_PATH ${qt_loc} ${libs_loc}/local)
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)
if (QT_VERSION_MAJOR GREATER_EQUAL 6)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL OpenGLWidgets REQUIRED)
endif()
if (LINUX)
find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS DBus WaylandClient WaylandCompositor QUIET)
endif()
set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "(gen)")
set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER "(gen)")