From f2d15b9683c58755cf53250ca30fa60b9c4eb215 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 11 Oct 2019 13:42:06 +0200 Subject: [PATCH] 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 --- cmake/QtBuild.cmake | 10 +++++++++- util/cmake/pro2cmake.py | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 2e29eec8e5b..8c9e9bcd8fc 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -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") diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index bf73c87e449..a9504d17c98 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -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")