CMake: Mostly unify includes into a single location

Make the QtBuildRepoHelpers and QtBuildRepoExamplesHelpers files
that were previously loaded as part of BuildInternals package instead
be loaded when qt_internal_include_all_helpers is called.

Load all the helpers as soon as find_package(QtBuildInternals) is
called rather than when qt_build_repo() is called.

This is a behavior change, but because including the Qt's Helpers
should have no side-effects aside from defining functions,
it should be fine.

This lets us have a unified location where to include Helpers files,
instead of thinking whether it needs to be done in QtBuildInternals or
in QtBuildHelpers or some other place.

Move also some additional inclusions into the same function.

Note that including some upstream CMake files like CMakeFindBinUtils
does have side-effects, but we've been doing it already anyway,
so moving it to the top should not make a difference because any
modifications we would do to the globally assigned variables would
have come later when we actually called our own functions.

Task-number: QTBUG-86035
Change-Id: I33f36f7e8db69d504c34a4d4a094b98f6fa50ee4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 2b1f2338631ae24614637b90c45f2778c3c77e37)
This commit is contained in:
Alexandru Croitor 2023-11-17 16:46:45 +01:00
parent de21686f47
commit a5050ce8e2
8 changed files with 11 additions and 15 deletions

View File

@ -63,10 +63,8 @@ qt_copy_or_install(
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/QtBuildInternals/${__build_internals_standalone_test_template_dir}/CMakeLists.txt")
include(QtToolchainHelpers)
qt_internal_create_toolchain_file()
include(QtWrapperScriptHelpers)
qt_internal_create_wrapper_scripts()
## Library to hold global features:
@ -134,7 +132,6 @@ target_include_directories(GlobalConfigPrivate INTERFACE
)
add_library(Qt::GlobalConfigPrivate ALIAS GlobalConfigPrivate)
include(QtPlatformTargetHelpers)
qt_internal_setup_public_platform_target()
# defines PlatformCommonInternal PlatformModuleInternal PlatformPluginInternal PlatformToolInternal

View File

@ -1,7 +1,4 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
include(QtBuildHelpers)
qt_internal_include_all_helpers()
qt_internal_setup_build_and_global_variables()

View File

@ -123,7 +123,9 @@ endmacro()
macro(qt_internal_include_all_helpers)
# Upstream cmake modules.
include(CheckCXXSourceCompiles)
include(CMakeFindBinUtils)
include(CMakePackageConfigHelpers)
include(FeatureSummary)
# Internal helpers available only while building Qt itself.
include(Qt3rdPartyLibraryHelpers)
@ -133,7 +135,10 @@ macro(qt_internal_include_all_helpers)
include(QtBuildInformation)
include(QtBuildOptionsHelpers)
include(QtBuildPathsHelpers)
include(QtBuildRepoExamplesHelpers)
include(QtBuildRepoHelpers)
include(QtCMakeHelpers)
include(QtCMakeVersionHelpers)
include(QtDbusHelpers)
include(QtDeferredDependenciesHelpers)
include(QtDocsHelpers)
@ -151,7 +156,9 @@ macro(qt_internal_include_all_helpers)
include(QtModuleHelpers)
include(QtNoLinkTargetHelpers)
include(QtPkgConfigHelpers)
include(QtPlatformTargetHelpers)
include(QtPluginHelpers)
include(QtPostProcessHelpers)
include(QtPrecompiledHeadersHelpers)
include(QtPriHelpers)
include(QtPrlHelpers)
@ -166,9 +173,11 @@ macro(qt_internal_include_all_helpers)
include(QtSyncQtHelpers)
include(QtTargetHelpers)
include(QtTestHelpers)
include(QtToolchainHelpers)
include(QtToolHelpers)
include(QtUnityBuildHelpers)
include(QtWasmHelpers)
include(QtWrapperScriptHelpers)
# Helpers that are available in public projects and while building Qt itself.
include(QtPublicAppleHelpers)

View File

@ -27,7 +27,6 @@ function(qt_print_feature_summary)
endif()
endif()
include(FeatureSummary)
# Show which packages were found.
feature_summary(INCLUDE_QUIET_PACKAGES
WHAT PACKAGES_FOUND

View File

@ -62,7 +62,7 @@ if(NOT QT_BUILD_INTERNALS_SKIP_CMAKE_MODULE_PATH_ADDITION)
qt_set_up_build_internals_paths()
endif()
include(QtBuildRepoExamplesHelpers)
include(QtBuildRepoHelpers)
include(QtBuildHelpers)
qt_internal_include_all_helpers()
qt_internal_setup_build_internals()

View File

@ -9,7 +9,6 @@
# components that are involved in build procedure.
macro(qt_internal_project_setup)
# Check for the minimum CMake version.
include(QtCMakeVersionHelpers)
qt_internal_require_suitable_cmake_version()
qt_internal_upgrade_cmake_policies()
endmacro()
@ -20,7 +19,6 @@ macro(qt_build_internals_set_up_private_api)
# Qt specific setup common for all modules:
include(QtSetup)
include(FeatureSummary)
# Optionally include a repo specific Setup module.
include(${PROJECT_NAME}Setup OPTIONAL)

View File

@ -1,8 +1,6 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
include(QtPostProcessHelpers)
qt_internal_create_depends_files()
qt_generate_build_internals_extra_cmake_code()
qt_internal_create_plugins_auto_inclusion_files()

View File

@ -1,8 +1,6 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
include(CMakeFindBinUtils)
if(CMAKE_VERSION VERSION_LESS 3.17.0)
set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${CMAKE_CURRENT_LIST_DIR})
endif()