Skip to content

Commit 13a7e25

Browse files
committed
Avoid collecting dependencies from modules that were explicitly skipped
If either -skip <module> or BUILD_<module>=OFF is set from command line we should avoid processing the module dependencies and exclude it from the list of modules that needs to be build. Pick-to: 6.7 Change-Id: Ieec8db085221cc4abd5d8ac83c06ecce25d5d4b0 Reviewed-by: Alexandru Croitor <[email protected]>
1 parent d77a38f commit 13a7e25

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

Diff for: CMakeLists.txt

+13-2
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,26 @@ include(ECMOptionalAddSubdirectory)
2929

3030
qt_internal_top_level_before_build_submodules()
3131

32+
qt_internal_find_modules(known_submodules)
3233
# Get submodule list if not already defined
3334
if(NOT QT_BUILD_SUBMODULES)
3435
if(DEFINED ENV{QT_BUILD_SUBMODULES})
3536
set(QT_BUILD_SUBMODULES "$ENV{QT_BUILD_SUBMODULES}")
3637
else()
37-
qt_internal_find_modules(QT_BUILD_SUBMODULES)
38+
set(QT_BUILD_SUBMODULES "${known_submodules}")
3839
endif()
3940
endif()
4041
set(QT_BUILD_SUBMODULES "${QT_BUILD_SUBMODULES}" CACHE STRING "Submodules to build")
4142

43+
# Preliminary check if module should be skipped since -skip <module> or BUILD_<module>
44+
# are provided.
45+
set(explicitly_skipped_modules "")
46+
foreach(module IN LISTS known_submodules)
47+
if(DEFINED BUILD_${module} AND NOT BUILD_${module})
48+
list(APPEND explicitly_skipped_modules ${module})
49+
endif()
50+
endforeach()
51+
4252
foreach(module IN LISTS QT_BUILD_SUBMODULES)
4353
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${module}/CMakeLists.txt)
4454
message(FATAL_ERROR
@@ -49,7 +59,8 @@ foreach(module IN LISTS QT_BUILD_SUBMODULES)
4959
endif()
5060
endforeach()
5161

52-
qt_internal_sort_module_dependencies("${QT_BUILD_SUBMODULES}" QT_BUILD_SUBMODULES)
62+
qt_internal_sort_module_dependencies("${QT_BUILD_SUBMODULES}" QT_BUILD_SUBMODULES
63+
SKIP_MODULES ${explicitly_skipped_modules})
5364

5465
foreach(module IN LISTS QT_BUILD_SUBMODULES)
5566
# Check for unmet dependencies

Diff for: cmake/QtTopLevelHelpers.cmake

+20-4
Original file line numberDiff line numberDiff line change
@@ -184,22 +184,24 @@ endfunction()
184184
#
185185
# NORMALIZE_REPO_NAME_IF_NEEDED Will remove 'tqtc-' from the beginning of submodule dependencies
186186
# if a tqtc- named directory does not exist.
187+
#
188+
# SKIP_MODULES Modules that should be skipped from evaluation completely.
187189
function(qt_internal_resolve_module_dependencies module out_ordered out_revisions)
188190
set(options IN_RECURSION NORMALIZE_REPO_NAME_IF_NEEDED PARSE_GITMODULES
189191
EXCLUDE_OPTIONAL_DEPS)
190192
set(oneValueArgs REVISION SKIPPED_VAR GITMODULES_PREFIX_VAR)
191-
set(multiValueArgs PARSED_DEPENDENCIES)
193+
set(multiValueArgs PARSED_DEPENDENCIES SKIP_MODULES)
192194
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
193195

194196
# Clear the property that stores the repositories we've already seen.
195197
if(NOT arg_IN_RECURSION)
196198
set_property(GLOBAL PROPERTY _qt_internal_seen_repos)
197199
endif()
198200

199-
# Bail out if we've seen the module already.
201+
# Bail out if we've seen the module already or it was skipped explicitly from command line.
200202
qt_internal_resolve_module_dependencies_set_skipped(FALSE)
201203
get_property(seen GLOBAL PROPERTY _qt_internal_seen_repos)
202-
if(module IN_LIST seen)
204+
if(module IN_LIST seen OR module IN_LIST arg_SKIP_MODULES)
203205
qt_internal_resolve_module_dependencies_set_skipped(TRUE)
204206
return()
205207
endif()
@@ -287,6 +289,11 @@ function(qt_internal_resolve_module_dependencies module out_ordered out_revision
287289
set(exclude_optional_deps "EXCLUDE_OPTIONAL_DEPS")
288290
endif()
289291

292+
set(extra_options "")
293+
if(arg_SKIP_MODULES)
294+
list(extra_options APPEND SKIP_MODULES ${arg_SKIP_MODULES})
295+
endif()
296+
290297
qt_internal_resolve_module_dependencies(${dependency} dep_ordered dep_revisions
291298
REVISION "${revision}"
292299
SKIPPED_VAR skipped
@@ -295,6 +302,7 @@ function(qt_internal_resolve_module_dependencies module out_ordered out_revision
295302
${parse_gitmodules}
296303
${exclude_optional_deps}
297304
GITMODULES_PREFIX_VAR ${arg_GITMODULES_PREFIX_VAR}
305+
${extra_options}
298306
)
299307
if(NOT skipped)
300308
list(APPEND ordered ${dep_ordered})
@@ -321,11 +329,13 @@ endfunction()
321329
# EXCLUDE_OPTIONAL_DEPS is a keyword argument that excludes optional dependencies from the result.
322330
# See qt_internal_resolve_module_dependencies for details.
323331
#
332+
# SKIP_MODULES Modules that should be skipped from evaluation completely.
333+
#
324334
# See qt_internal_resolve_module_dependencies for side effects.
325335
function(qt_internal_sort_module_dependencies modules out_all_ordered)
326336
set(options PARSE_GITMODULES EXCLUDE_OPTIONAL_DEPS)
327337
set(oneValueArgs GITMODULES_PREFIX_VAR)
328-
set(multiValueArgs "")
338+
set(multiValueArgs SKIP_MODULES)
329339
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
330340

331341
set(parse_gitmodules "")
@@ -345,12 +355,18 @@ function(qt_internal_sort_module_dependencies modules out_all_ordered)
345355
list(APPEND all_selected_repos_as_parsed_dependencies "${module}/HEAD/FALSE")
346356
endforeach()
347357

358+
set(extra_args "")
359+
if(arg_SKIP_MODULES)
360+
set(extra_args SKIP_MODULES ${arg_SKIP_MODULES})
361+
endif()
362+
348363
qt_internal_resolve_module_dependencies(all_selected_repos ordered unused_revisions
349364
PARSED_DEPENDENCIES ${all_selected_repos_as_parsed_dependencies}
350365
NORMALIZE_REPO_NAME_IF_NEEDED
351366
${exclude_optional_deps}
352367
${parse_gitmodules}
353368
GITMODULES_PREFIX_VAR ${arg_GITMODULES_PREFIX_VAR}
369+
${extra_args}
354370
)
355371

356372
# Drop "all_selected_repos" from the output. It depends on all selected repos, thus it must be

0 commit comments

Comments
 (0)