mirror of https://github.com/qt/qt5.git
Fix the broken semicolon separated list arguments for configure
When evaluating the arguments from the config.tl.opt file we need to consider that arguments may contain the escaped semicolons for the list arguments. The escaped semicolons '\;' needs to be converted to a CMake brace escaped sequence to make sure that semicolon persist when running the command. Fixes: QTBUG-124265 Change-Id: I051f856b43f75b0bac17ae13bd8c7de540f8c794 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
9eae314404
commit
a3a8e3421e
|
@ -244,6 +244,7 @@ endfunction()
|
|||
# Reads the command line arguments from the optfile_path.
|
||||
function(qt_ir_get_raw_args_from_optfile optfile_path out_var)
|
||||
file(STRINGS "${optfile_path}" args)
|
||||
qt_ir_escape_semicolons(args "${args}")
|
||||
set(${out_var} "${args}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ endfunction()
|
|||
# to run the perly script manually.
|
||||
function(qt_ir_show_error_how_to_run_perl opt_file unsupported_option_name)
|
||||
qt_ir_get_raw_args_from_optfile("${opt_file}" args)
|
||||
string(REPLACE ";" " " args "${args}")
|
||||
qt_ir_prettify_command_args(args "${args}")
|
||||
|
||||
set(perl_cmd "perl ./init-repository.pl ${args}")
|
||||
|
||||
|
|
|
@ -53,10 +53,11 @@ function(qt_ir_execute_process)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" " " command_args_string "${arg_COMMAND_ARGS}")
|
||||
qt_ir_prettify_command_args(command_args_string "${arg_COMMAND_ARGS}")
|
||||
message("+ ${command_args_string}${working_dir_message}")
|
||||
endif()
|
||||
|
||||
qt_ir_unescape_semicolons(arg_COMMAND_ARGS "${arg_COMMAND_ARGS}")
|
||||
execute_process(
|
||||
COMMAND ${arg_COMMAND_ARGS}
|
||||
${working_dir}
|
||||
|
@ -76,6 +77,25 @@ function(qt_ir_execute_process)
|
|||
endif()
|
||||
endfunction()
|
||||
|
||||
# Guards the escaped semicolon sequences with square brackets.
|
||||
function(qt_ir_escape_semicolons out_var input_string)
|
||||
string(REPLACE "\;" "[[;]]" ${out_var} "${input_string}")
|
||||
set(${out_var} "${${out_var}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Removes the square bracket guards around semicolons and escape them.
|
||||
function(qt_ir_unescape_semicolons out_var input_string)
|
||||
string(REPLACE "[[;]]" "\;" ${out_var} "${input_string}")
|
||||
set(${out_var} "${${out_var}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Converts the command line arguments to a nice bash runnable string
|
||||
function(qt_ir_prettify_command_args output args)
|
||||
list(JOIN args " " ${output})
|
||||
qt_ir_unescape_semicolons(${output} "${${output}}")
|
||||
set(${output} "${${output}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# A higher level execute_process wrapper that can be used to execute a single command
|
||||
# that is a bit more opinionated and expects options related to init-repository
|
||||
# functionality.
|
||||
|
@ -142,7 +162,7 @@ function(qt_ir_execute_process_and_log_and_handle_error)
|
|||
set(error_message "${arg_ERROR_MESSAGE}\n")
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" " " cmd "${arg_COMMAND_ARGS}")
|
||||
qt_ir_prettify_command_args(cmd "${arg_COMMAND_ARGS}")
|
||||
string(APPEND error_message "${cmd} exited with status: ${proc_result}\n")
|
||||
if(proc_output)
|
||||
string(APPEND error_message "stdout: ${proc_output}\n")
|
||||
|
|
Loading…
Reference in New Issue