diff --git a/cmake/QtIRCommandLineHelpers.cmake b/cmake/QtIRCommandLineHelpers.cmake index 8856e980..51aa21a4 100644 --- a/cmake/QtIRCommandLineHelpers.cmake +++ b/cmake/QtIRCommandLineHelpers.cmake @@ -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 # diff --git a/cmake/QtIRHelpers.cmake b/cmake/QtIRHelpers.cmake index c4d8b7f2..a6099591 100644 --- a/cmake/QtIRHelpers.cmake +++ b/cmake/QtIRHelpers.cmake @@ -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) diff --git a/cmake/QtIROptionsHelpers.cmake b/cmake/QtIROptionsHelpers.cmake index aa88b026..2b3ff1c4 100644 --- a/cmake/QtIROptionsHelpers.cmake +++ b/cmake/QtIROptionsHelpers.cmake @@ -38,6 +38,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()