From aee1d1e96b100c503344d86779ece72325ac17e9 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 23 Jan 2019 12:57:06 +0100 Subject: [PATCH] CMake: pro2cmake.py: Work on mapping of conditions to cmake Make sure complex things in qmake (e.g. function calls, etc.) are mapped better to cmake. When there is no way to properly map the qmake construct, then make sure to map everything into one identifier. This is to keep the structure of the condition simple. Change-Id: I6d88e0cb85fce1041bbfdc96604dab7bd4e65856 Reviewed-by: Simon Hausmann --- util/cmake/pro2cmake.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 0e4ed743622..52e67e482d1 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -517,6 +517,14 @@ def parseProFile(file: str, *, debug=False): def map_condition(condition: str) -> str: + re.sub(r"\bif\s*\((.*?)\)", r"\1", condition) + re.sub(r"\bisEmpty\s*\((.*?)\)", r"\1 STREQUAL \"\"", condition) + re.sub(r"\bcontains\s*\((.*?), (.*)?\)", r"\1___contains___\2", condition) + + condition = condition.replace('*', '_x_') + condition = condition.replace('.$$', '__ss_') + condition = condition.replace('$$', '_ss_') + condition = condition.replace('!', 'NOT ') condition = condition.replace('&&', ' AND ') condition = condition.replace('|', ' OR ')