CMake: Warn about unsupported generator for all qt submodules

Previously we only warned about unsupported cmake generators when
configuring qtbase.
Now we do it for other submodules as well.

Pick-to: 6.6 6.5
Task-number: QTBUG-120602
Change-Id: I9d78db546bcf1238604362b248d41d4516b60b2a
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 9932f2dd479baefb915ad841c95855d61b764ab6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexandru Croitor 2024-01-16 13:43:32 +01:00 committed by Qt Cherry-pick Bot
parent dbda879127
commit ea47b017d4
2 changed files with 16 additions and 10 deletions

View File

@ -64,15 +64,6 @@ function(qt_auto_detect_wasm)
endif()
endfunction()
function(qt_auto_detect_cmake_generator)
if(NOT CMAKE_GENERATOR MATCHES "Ninja" AND NOT QT_SILENCE_CMAKE_GENERATOR_WARNING)
message(WARNING
"The officially supported CMake generator for building Qt is Ninja. "
"You are using: '${CMAKE_GENERATOR}' instead. "
"Thus, you might encounter issues. Use at your own risk.")
endif()
endfunction()
function(qt_auto_detect_android)
# We assume an Android build if any of the ANDROID_* cache variables are set.
if(DEFINED ANDROID_SDK_ROOT
@ -474,7 +465,6 @@ macro(qt_internal_setup_autodetect)
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/platforms")
endif()
qt_auto_detect_cmake_generator()
qt_auto_detect_cyclic_toolchain()
qt_auto_detect_cmake_config()
qt_auto_detect_darwin()

View File

@ -1,6 +1,21 @@
# Copyright (C) 2023 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
function(qt_internal_validate_cmake_generator)
get_property(warning_shown GLOBAL PROPERTY _qt_validate_cmake_generator_warning_shown)
if(NOT warning_shown
AND NOT CMAKE_GENERATOR MATCHES "Ninja"
AND NOT QT_SILENCE_CMAKE_GENERATOR_WARNING)
set_property(GLOBAL PROPERTY _qt_validate_cmake_generator_warning_shown TRUE)
message(WARNING
"The officially supported CMake generator for building Qt is "
"Ninja / Ninja Multi-Config. "
"You are using: '${CMAKE_GENERATOR}' instead. "
"Thus, you might encounter issues. Use at your own risk.")
endif()
endfunction()
macro(qt_internal_set_qt_building_qt)
# Set the QT_BUILDING_QT variable so we can verify whether we are building
# Qt from source.
@ -362,6 +377,7 @@ macro(qt_internal_setup_android_platform_specifics)
endmacro()
macro(qt_internal_setup_build_and_global_variables)
qt_internal_validate_cmake_generator()
qt_internal_set_qt_building_qt()
qt_internal_compute_features_from_possible_inputs()