CMake: Check minimum MSVC version when configuring Qt

MSVC 2019 support was dropped from Qt 6.8. Bail out early if someone
wants to build Qt with it.

One can opt out of the version check by setting the CMake variable
QT_NO_MSVC_MIN_VERSION_CHECK to ON.

Pick-to: 6.8
Change-Id: Ia1f5668e1cddcd0c9f0a8d50482fb50d0c5afe7e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Joerg Bornemann 2024-12-03 15:51:53 +01:00
parent ae6b6bf363
commit 9a409295c7
2 changed files with 18 additions and 0 deletions

View File

@ -213,6 +213,7 @@ function(qt_internal_get_qt_build_private_helpers out_var)
QtToolchainHelpers
QtUnityBuildHelpers
QtWasmHelpers
QtWindowsHelpers
QtWrapperScriptHelpers
PARENT_SCOPE
)
@ -449,6 +450,7 @@ macro(qt_internal_setup_build_and_global_variables)
qt_internal_check_macos_host_version()
_qt_internal_check_apple_sdk_and_xcode_versions()
qt_internal_check_msvc_versions()
qt_internal_check_host_path_set_for_cross_compiling()
qt_internal_setup_android_platform_specifics()
qt_internal_setup_find_host_info_package()

View File

@ -0,0 +1,16 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
function(qt_internal_check_msvc_versions)
if(NOT MSVC OR QT_NO_MSVC_MIN_VERSION_CHECK)
return()
endif()
set(min_msvc_version "1930")
if(MSVC_VERSION VERSION_LESS min_msvc_version)
message(FATAL_ERROR
"Qt requires at least Visual Studio 2019 (MSVC ${min_msvc_version} or newer), "
"you're building against version ${MSVC_VERSION}. "
"You can turn off this version check by setting QT_NO_MSVC_MIN_VERSION_CHECK to ON."
)
endif()
endfunction()