From 0ec83c2903a92e91eb566046c1355e57a71eca2b Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 21 Jan 2022 21:55:08 +0100 Subject: CMake: Rework inter-repository dependency resolution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In certain cases the dependency resolution between Qt repositories resulted in a wrong order, for example qtsvg being handled before qtbase. See the linked task for an example. Replace the existing algorithm with a post-order traversal of the dependency graph to produce a topological ordering. Rename qt_internal_add_module_dependencies to qt_internal_resolve_module_dependencies and remove unnecessary positional arguments. Use keyword arguments for a nicer API. Raise the cmake_policy in QtSynchronizeRepo.cmake to avoid policy warnings we now would get due to the use of IN_LIST. Fixes: QTBUG-98268 Change-Id: I1425fd9c802fa71ae42549ceb14bcfc4c0a62078 Reviewed-by: Alexandru Croitor (cherry picked from commit 8a94d1e2946644253cf2979c35636cbfb850422d) Reviewed-by: Jörg Bornemann --- CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index a0f4d76c..b1afb2f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,16 +52,15 @@ if(NOT QT_BUILD_SUBMODULES) endif() set(QT_BUILD_SUBMODULES "${QT_BUILD_SUBMODULES}" CACHE STRING "Submodules to build") -set(qt_module_dependency_map_prefix "__qt_module_dependencies_") -qt_internal_sort_module_dependencies("${QT_BUILD_SUBMODULES}" QT_BUILD_SUBMODULES - "${qt_module_dependency_map_prefix}") +qt_internal_sort_module_dependencies("${QT_BUILD_SUBMODULES}" QT_BUILD_SUBMODULES) foreach(module IN LISTS QT_BUILD_SUBMODULES) # Check for unmet dependencies if(NOT DEFINED BUILD_${module} OR BUILD_${module}) message(NOTICE "Checking dependencies of '${module}'") get_property(required_deps GLOBAL PROPERTY QT_REQUIRED_DEPS_FOR_${module}) - foreach(dep IN LISTS "${qt_module_dependency_map_prefix}${module}") + get_property(dependencies GLOBAL PROPERTY QT_DEPS_FOR_${module}) + foreach(dep IN LISTS dependencies) if (dep STREQUAL "qtbase") # Always available skip continue() -- cgit v1.2.3