diff options
author | Volker Krause <vkrause@kde.org> | 2021-03-22 15:38:36 +0200 |
---|---|---|
committer | David Faure <faure@kde.org> | 2021-11-23 17:22:51 +0100 |
commit | c5a034a6b5218ebc9f7eb38387c9d91fa3e4134d (patch) | |
tree | 9eb80f208475098fc883e5a2fd28478caf67f73d /modules | |
parent | aa219585ffdf8962c0b1087848b18fef8b6206b7 (diff) | |
download | extra-cmake-modules-c5a034a6b5218ebc9f7eb38387c9d91fa3e4134d.tar.gz extra-cmake-modules-c5a034a6b5218ebc9f7eb38387c9d91fa3e4134d.tar.bz2 |
Split KDEInstallDirs into a 5 and a 6 variant
This factors out large parts of the common code into separate modules,
and adds a backward compatibility wrapper.
The 6 variant drops some deprecated variables where possible, but otherwise
is the same as the 5 variant. It still lacks a replacement for the paths
depending on ECMQueryQMake though.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/QtVersionOption.cmake | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/modules/QtVersionOption.cmake b/modules/QtVersionOption.cmake new file mode 100644 index 00000000..1390f9db --- /dev/null +++ b/modules/QtVersionOption.cmake @@ -0,0 +1,38 @@ +#.rst: +# QtVersionOption +# --------------- +# +# Adds a build option to select the major Qt version if necessary, +# that is, if the major Qt version has not yet been determined otherwise +# (e.g. by a corresponding find_package() call). +# +# This module is typically included by other modules requiring knowledge +# about the major Qt version. +# +# ``QT_MAJOR_VERSION`` is defined to either be "5" or "6". +# +# +# Since 5.82.0. + +#============================================================================= +# SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org> +# +# SPDX-License-Identifier: BSD-3-Clause + +if (DEFINED QT_MAJOR_VERSION) + return() +endif() + +if (TARGET Qt5::Core) + set(QT_MAJOR_VERSION 5) +elseif (TARGET Qt6::Core) + set(QT_MAJOR_VERSION 6) +else() + option(BUILD_WITH_QT6 "Build against Qt 6" OFF) + + if (BUILD_WITH_QT6) + set(QT_MAJOR_VERSION 6) + else() + set(QT_MAJOR_VERSION 5) + endif() +endif() |