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()