Warning, /frameworks/extra-cmake-modules/modules/QtVersionOption.cmake is written in an unsupported language. File is not indexed.

0001 # SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
0002 #
0003 # SPDX-License-Identifier: BSD-3-Clause
0004 
0005 #[=======================================================================[.rst:
0006 QtVersionOption
0007 ---------------
0008 
0009 Adds a build option to select the major Qt version if necessary,
0010 that is, if the major Qt version has not yet been determined otherwise
0011 (e.g. by a corresponding ``find_package()`` call).
0012 This module is typically included by other modules requiring knowledge
0013 about the major Qt version.
0014 
0015 If the ECM version passed to find_package was at least 5.240.0 Qt6 is picked by default.
0016 Otherwise Qt5 is picked.
0017 
0018 ``QT_MAJOR_VERSION`` is defined to either be "5" or "6".
0019 
0020 Since 5.82.0.
0021 #]=======================================================================]
0022 
0023 if (DEFINED QT_MAJOR_VERSION)
0024     return()
0025 endif()
0026 
0027 if (TARGET Qt5::Core)
0028     set(QT_MAJOR_VERSION 5)
0029 elseif (TARGET Qt6::Core)
0030     set(QT_MAJOR_VERSION 6)
0031 else()
0032     if (ECM_GLOBAL_FIND_VERSION VERSION_GREATER_EQUAL 5.240)
0033         option(BUILD_WITH_QT6 "Build against Qt 6" ON)
0034     else()
0035         option(BUILD_WITH_QT6 "Build against Qt 6" OFF)
0036     endif()
0037 
0038     if (BUILD_WITH_QT6)
0039         set(QT_MAJOR_VERSION 6)
0040     else()
0041         set(QT_MAJOR_VERSION 5)
0042     endif()
0043 endif()