From 199cce0c20108e657d3b3555cdeacb76412fa28f Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Thu, 7 Feb 2019 15:28:49 +0100 Subject: [PATCH] CMake: pro2cmake.py: Better mapping of complex conditions .pro-files support things like contains(Foo, bar), etc. Map that in such a way that only one identifier will be visible to CMake to unconfuse the logic handling on that side. These conditions will need manual fixup later! Change-Id: Id4946e694a9adccf9f54bcce26a6c227cd921007 Reviewed-by: Albert Astals Cid Reviewed-by: Frederik Gladhorn --- util/cmake/pro2cmake.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index da81294e3a..5c804826c4 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -588,11 +588,11 @@ def parseProFile(file: str, *, debug=False): def map_condition(condition: str) -> str: - re.sub(r'if\s*\((.*?)\)', r'\1', condition) - re.sub(r'(^|[^a-zA-Z0-9_])isEmpty\s*\((.*?)\)', r'\2_ISEMPTY', condition) - re.sub(r'(^|[^a-zA-Z0-9_])contains\s*\((.*?), (.*)?\)', - r'\2___contains___\3', condition) - re.sub(r'\s*==\s*', '___STREQUAL___', condition) + condition = re.sub(r'\bif\s*\((.*?)\)', r'\1', condition) + condition = re.sub(r'\bisEmpty\s*\((.*?)\)', r'\1_ISEMPTY', condition) + condition = re.sub(r'\bcontains\s*\((.*?), (.*)?\)', + r'\1___contains___\2', condition) + condition = re.sub(r'\s*==\s*', '___STREQUAL___', condition) condition = condition.replace('*', '_x_') condition = condition.replace('.$$', '__ss_')