From 780c780763ad9cda04334947cc0c27c5676aa51f Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Mon, 27 May 2024 18:11:11 +0200 Subject: [PATCH] Fix the support of the '-verbose' argument in configure script Init repository logic eats the '-verbose' argument as the one that is handled by internal init repository logic. The argument is also a valid argument for configure script. Introduce the 'COMMON' argument for of the qt_ir_commandline_option macro. The argument indicates that the option is applicable for both configure and init-repository scripts. This is implemented only for boolean arguments. The '-verbose' argument adopted the new feature. Pick-to: 6.7 6.8 Change-Id: I5cb76502c8ecccccf3546fd7f7f111fe25700d0a Reviewed-by: Alexandru Croitor --- cmake/QtIRCommandLineHelpers.cmake | 20 +++++++++++++++++++- cmake/QtIROptionsHelpers.cmake | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/cmake/QtIRCommandLineHelpers.cmake b/cmake/QtIRCommandLineHelpers.cmake index 57c978af..d3569dd7 100644 --- a/cmake/QtIRCommandLineHelpers.cmake +++ b/cmake/QtIRCommandLineHelpers.cmake @@ -59,7 +59,7 @@ endfunction() # Helper macro to parse the arguments for the command line options. macro(qt_ir_commandline_option_parse_arguments) - set(options UNSUPPORTED) + set(options UNSUPPORTED COMMON) set(oneValueArgs TYPE NAME SHORT_NAME ALIAS VALUE DEFAULT_VALUE) set(multiValueArgs VALUES MAPPING) cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) @@ -81,6 +81,7 @@ endmacro() # same value when retrieved. # DEFAULT_VALUE - the default value to be set for the option when it's not specified # on the command line +# COMMON - the argument is common for init-repository and configure scripts # # NOTE: Make sure to update the SHORT_NAME code path when adding new options. function(qt_ir_commandline_option_helper name) @@ -97,6 +98,14 @@ function(qt_ir_commandline_option_helper name) set(commandline_known_options "${commandline_known_options};${name}" PARENT_SCOPE) + if(arg_COMMON) + set(commandline_option_${name}_common "true" PARENT_SCOPE) + if(NOT "${arg_TYPE}" STREQUAL "boolean") + message(FATAL_ERROR "${name} is '${arg_TYPE}', but COMMON arguments can be" + " 'boolean' only.") + endif() + endif() + set(commandline_option_${name}_type "${arg_TYPE}" PARENT_SCOPE) if(NOT "${arg_VALUE}" STREQUAL "") @@ -140,6 +149,11 @@ macro(qt_ir_commandline_option name) set(unsupported "UNSUPPORTED") endif() + set(common "") + if(arg_COMMON) + set(common "COMMON") + endif() + qt_ir_commandline_option_helper("${arg_SHORT_NAME}" TYPE "${arg_TYPE}" ALIAS "${name}" @@ -148,6 +162,7 @@ macro(qt_ir_commandline_option name) MAPPING ${arg_MAPPING} DEFAULT_VALUE ${arg_DEFAULT_VALUE} ${unsupported} + ${common} ) endif() endmacro() @@ -323,6 +338,9 @@ function(qt_ir_process_args_from_optfile optfile_path) qt_ir_append_unknown_args("${arg}") continue() endif() + elseif(commandline_option_${opt}_common AND arg_IGNORE_UNKNOWN_ARGS) + message(DEBUG "Common command line option '${arg}'. Collecting.") + qt_ir_append_unknown_args("${arg}") endif() if(NOT COMMAND "qt_ir_commandline_${type}") diff --git a/cmake/QtIROptionsHelpers.cmake b/cmake/QtIROptionsHelpers.cmake index d87c7463..496ec42b 100644 --- a/cmake/QtIROptionsHelpers.cmake +++ b/cmake/QtIROptionsHelpers.cmake @@ -29,7 +29,7 @@ macro(qt_ir_set_known_command_line_options) qt_ir_commandline_option(quiet SHORT_NAME q TYPE boolean) qt_ir_commandline_option(resolve-deps TYPE boolean DEFAULT_VALUE yes) qt_ir_commandline_option(update TYPE boolean DEFAULT_VALUE yes) - qt_ir_commandline_option(verbose TYPE boolean) + qt_ir_commandline_option(verbose TYPE boolean COMMON) # These are used when init-repository is called from configure. qt_ir_commandline_option(from-configure TYPE boolean)