Fix configure -skip not forwarded to CMake

This amends commit 378c8719a9.

Since 378c8719a9, -skip is registered as a known option in
init-repository's option parser. This caused -skip values to be consumed
during option parsing and no longer appear in the unknown_args list that
gets forwarded to configure. As a result, -skip was silently ignored
when -init-submodules was not passed.

Fix by collecting skip modules into a dedicated list from two sources:
the -skip option values consumed by init-repository's parser, and
exclusion entries from -submodules/--module-subset. The merged list is
then forwarded to configure.

This also simplifies the previous merge logic that searched for -skip in
filtered_args, which became dead code after 378c8719a9.

Pick-to: 6.8 6.10 6.11
Task-number: QTBUG-140359
Change-Id: I816020959f86cf4b8e36ce1a62172acd442ed1d3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann
2026-02-23 12:59:28 +01:00
parent ab346b98dc
commit 1d4da9a59b

View File

@@ -130,6 +130,11 @@ function(qt_ir_get_args_from_optfile_configure_filtered optfile_path out_var)
set(extra_configure_args "")
set(extra_cmake_args "")
# Collect modules to skip. These may come from:
# 1. The -skip option (consumed by init-repository's option parser)
# 2. Exclusion entries in -submodules/--module-subset (e.g. -qtfoo)
qt_ir_get_option_value(skip skip_modules)
# If the -submodules or --module-subset options were specified, transform
# the values into something configure understands and pass them to configure.
qt_ir_get_option_value(module-subset submodules)
@@ -153,25 +158,10 @@ function(qt_ir_get_args_from_optfile_configure_filtered optfile_path out_var)
endif()
list(JOIN include_submodules "," include_submodules)
list(JOIN exclude_submodules "," exclude_submodules)
# Handle case when the -skip argument is already passed.
# In that case read the passed values, merge with new ones,
# remove both the -skip and its values, and re-add it later.
list(FIND filtered_args "-skip" skip_index)
if(exclude_submodules AND skip_index GREATER -1)
list(LENGTH filtered_args filtered_args_length)
math(EXPR skip_args_index "${skip_index} + 1")
if(skip_args_index LESS filtered_args_length)
list(GET filtered_args "${skip_args_index}" skip_args)
string(REPLACE "," ";" skip_args "${skip_args}")
list(APPEND skip_args ${exclude_submodules})
list(REMOVE_DUPLICATES skip_args)
list(JOIN skip_args "," exclude_submodules)
list(REMOVE_AT filtered_args "${skip_args_index}")
list(REMOVE_AT filtered_args "${skip_index}")
endif()
# Merge exclusions from module-subset into the skip list.
if(exclude_submodules)
list(APPEND skip_modules ${exclude_submodules})
endif()
# Handle case when only '-submodules existing' is passed and the
@@ -179,9 +169,13 @@ function(qt_ir_get_args_from_optfile_configure_filtered optfile_path out_var)
if(include_submodules)
list(APPEND extra_configure_args "-submodules" "${include_submodules}")
endif()
if(exclude_submodules)
list(APPEND extra_configure_args "-skip" "${exclude_submodules}")
endif()
endif()
# Forward all collected skip modules to configure.
if(skip_modules)
list(REMOVE_DUPLICATES skip_modules)
list(JOIN skip_modules "," skip_csv)
list(APPEND extra_configure_args "-skip" "${skip_csv}")
endif()
# Insert the extra arguments into the proper positions before and after '--'.