Fix configure -init-submodules ignoring -skip option

When running configure -init-submodules -skip <module>, the -skip
option was ignored because init-repository ran before -skip values
were processed. The skipped modules were still initialized.

Fix by preprocessing -skip values in qt_tl_run_main_script() before
calling qt_ir_run_main_script(). The -skip values are converted to
module-subset exclusions (e.g. -qtwebengine) and merged with the
existing module-subset option.

Also register -skip as a known option in init-repository so it can
be parsed from the optfile.

Fixes: QTBUG-140359
Pick-to: 6.10 6.8
Change-Id: I37ed916dd1c22b6d10d23821044fee807919d4a9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 378c8719a9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Joerg Bornemann
2026-02-13 17:48:25 +01:00
committed by Qt Cherry-pick Bot
parent 546bcebdaa
commit b2fb8279dc
3 changed files with 38 additions and 1 deletions

View File

@@ -178,7 +178,6 @@ function(qt_ir_command_line_set_input name val)
endfunction()
# Appends a value of a command line option into a global property.
# Currently unused
function(qt_ir_command_line_append_input name val)
if(NOT "${commandline_option_${name}_alias}" STREQUAL "")
set(name "${commandline_option_${name}_alias}")
@@ -240,6 +239,22 @@ function(qt_ir_commandline_string arg val nextok)
endif()
endfunction()
# Like string, but appends to the existing value instead of overwriting.
# Allows repeated flags like: -skip qtwebengine -skip qtwebview
function(qt_ir_commandline_addString arg val nextok)
if(nextok)
qt_ir_args_get_next_command_line_arg(val)
if("${val}" MATCHES "^-")
qt_ir_add_error("No value supplied to command line options '${arg}'.")
endif()
endif()
qt_ir_validate_value("${arg}" "${val}" success)
if(success)
qt_ir_command_line_append_input("${arg}" "${val}")
endif()
endfunction()
# Sets / handles the value of a command line void option.
# This is an option like --force, which doesn't take any arguments.
# Currently unused
@@ -279,6 +294,7 @@ endfunction()
#
# Currently handles the following types of CLI arguments:
# string
# addString (like string, but accumulates values from repeated flags)
# boolean
# void
#

View File

@@ -89,6 +89,26 @@ function(qt_ir_handle_called_from_configure top_level_src_path out_var_exit_reas
qt_ir_validate_options_for_configure()
# Convert -skip values to module-subset exclusions so init-repository respects them.
qt_ir_get_option_value(skip skip_modules)
if(skip_modules)
string(REPLACE "," ";" skip_modules "${skip_modules}")
list(TRANSFORM skip_modules STRIP)
list(TRANSFORM skip_modules PREPEND "-")
qt_ir_get_option_value(module-subset existing_subset)
if(NOT existing_subset)
set(existing_subset "default")
endif()
list(APPEND skip_modules "${existing_subset}")
list(REMOVE_DUPLICATES skip_modules)
list(JOIN skip_modules "," merged_subset)
qt_ir_set_option_value(module-subset "${merged_subset}")
message(DEBUG "Preprocessed -skip option: module-subset is now: ${merged_subset}")
endif()
# -init_submodules implies --force
qt_ir_set_option_value(force TRUE)

View File

@@ -37,6 +37,7 @@ macro(qt_ir_set_known_command_line_options)
qt_ir_commandline_option(init-submodules TYPE boolean)
# We alias qtbase's submodules option to init-repository module-subset.
qt_ir_commandline_option(submodules ALIAS module-subset TYPE string)
qt_ir_commandline_option(skip TYPE addString)
set_property(GLOBAL PROPERTY _qt_ir_known_command_line_options "${commandline_known_options}")
endmacro()