summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2019-02-11 17:53:54 +0100
committerTobias Hunger <tobias.hunger@qt.io>2019-02-11 17:16:20 +0000
commit3726b58d3b7c595291c8a3f22ee518dffc382950 (patch)
tree51cf58f3ffdcd1f7b79e90b2835004ff9340ebf9
parentf18db41f8586e60460649b4032cc8b6c01700441 (diff)
CMake: pro2cmake.py: Simplify condition generation
There is no need to try and avoid extra () and NOTs: Those will be removed by sympy later anyway. Change-Id: I39d3e4d1d829579e532bfbbf6c69e0f1e06e9a22 Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
-rwxr-xr-xutil/cmake/pro2cmake.py20
1 files changed, 2 insertions, 18 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index f18abcc81f..90c36fc57c 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -1000,29 +1000,13 @@ def recursive_evaluate_scope(scope: Scope, parent_condition: str = '',
if total_condition == 'else':
assert previous_condition, \
"Else branch without previous condition in: %s" % scope.file
- if previous_condition.startswith('NOT '):
- total_condition = previous_condition[4:]
- elif is_simple_condition(previous_condition):
- total_condition = 'NOT {}'.format(previous_condition)
- else:
- total_condition = 'NOT ({})'.format(previous_condition)
+ total_condition = 'NOT ({})'.format(previous_condition)
if parent_condition:
if not total_condition:
total_condition = parent_condition
else:
- if is_simple_condition(parent_condition) \
- and is_simple_condition(total_condition):
- total_condition = '{} AND {}'.format(parent_condition,
+ total_condition = '({}) AND ({})'.format(parent_condition,
total_condition)
- elif is_simple_condition(total_condition):
- total_condition = '({}) AND {}'.format(parent_condition,
- total_condition)
- elif is_simple_condition(parent_condition):
- total_condition = '{} AND ({})'.format(parent_condition,
- total_condition)
- else:
- total_condition = '({}) AND ({})'.format(parent_condition,
- total_condition)
scope.total_condition = simplify_condition(total_condition)