Minor fix to qt_process_qlalr API

It's probably best to make it follow the usual calling convention that
the associated (consuming) target is the first parameter of the
function. So first this change accepts both formats.

Change-Id: I1f20706b23d5e819e0eb689eecedb3afb49df3b7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Simon Hausmann 2019-10-11 13:42:06 +02:00
parent 1dd82a8843
commit f2d15b9683
2 changed files with 10 additions and 2 deletions

View File

@ -3182,7 +3182,15 @@ endfunction()
# Generate a few output files using qlalr, and assign those to 'consuming_target'.
# 'input_file_list' is a list of 'foo.g' file paths.
# 'flags' are extra flags to be passed to qlalr.
function(qt_process_qlalr input_file_list consuming_target flags)
function(qt_process_qlalr consuming_target input_file_list flags)
# For compatibility, swap parameters if called from an old call site.
if (NOT TARGET "${consuming_target}")
set(tmp "${consuming_target}")
set(consuming_target "${input_file_list}")
set(input_file_list "${tmp}")
unset(tmp)
endif()
foreach(input_file ${input_file_list})
file(STRINGS ${input_file} input_file_lines)
qt_qlalr_find_option_in_list("${input_file_lines}" "^%parser(.+)" "parser")

View File

@ -1984,8 +1984,8 @@ def write_qlalrsources(cm_fh: IO[str], target: str, scope: Scope, indent: int =
cm_fh.write("\n# QLALR Grammars:\n")
cm_fh.write(f"qt_process_qlalr(\n")
indent += 1
cm_fh.write(f"{spaces(indent)}{';'.join(sources)}\n")
cm_fh.write(f"{spaces(indent)}{target}\n")
cm_fh.write(f"{spaces(indent)}{';'.join(sources)}\n")
cm_fh.write(f'{spaces(indent)}""\n')
cm_fh.write(")\n")