From ea47b017d421a15d83be9a4b8003f5c8448ffa12 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 16 Jan 2024 13:43:32 +0100 Subject: [PATCH] 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 (cherry picked from commit 9932f2dd479baefb915ad841c95855d61b764ab6) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtAutoDetectHelpers.cmake | 10 ---------- cmake/QtBuildHelpers.cmake | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/cmake/QtAutoDetectHelpers.cmake b/cmake/QtAutoDetectHelpers.cmake index 095a8d06bfa..ac24ed8f739 100644 --- a/cmake/QtAutoDetectHelpers.cmake +++ b/cmake/QtAutoDetectHelpers.cmake @@ -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() diff --git a/cmake/QtBuildHelpers.cmake b/cmake/QtBuildHelpers.cmake index 327c0a536e4..8b957d603d2 100644 --- a/cmake/QtBuildHelpers.cmake +++ b/cmake/QtBuildHelpers.cmake @@ -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()