diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-01-22 14:23:59 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-01-29 09:01:07 +0000 |
commit | 0a9e5e139a2c23553f4046897c3be4b1df3dfdfa (patch) | |
tree | 387cac538379325d071349016fe6881a18d41d9e | |
parent | 0e2762651ccbec541f59c7af5078fa69bd23d130 (diff) |
CMake: pro2cmake.py: Fix handling of complex else branches
Return the current scope's condition, not the total condition from
recursive_evaluate_scope. That is the part the "else" referrs to.
The parent_condition stays identical for all branches, so that should
not get negated.
Change-Id: I0da91483d4d748d01a29ac16890d709d8d659843
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rwxr-xr-x | util/cmake/pro2cmake.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 3130aeea02..114677e86e 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -718,7 +718,8 @@ def write_ignored_keys(scope: Scope, ignored_keys, indent) -> str: def recursive_evaluate_scope(scope: Scope, parent_condition: str = '', previous_condition: str = '') -> str: - total_condition = scope.condition() + current_condition = scope.condition() + total_condition = current_condition if total_condition == 'else': assert previous_condition, \ "Else branch without previous condition in: %s" % scope.file() @@ -753,7 +754,7 @@ def recursive_evaluate_scope(scope: Scope, parent_condition: str = '', prev_condition = recursive_evaluate_scope(c, total_condition, prev_condition) - return total_condition + return current_condition def write_extend_target(cm_fh: typing.IO[str], target: str, |