diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-01-23 12:57:06 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-01-29 09:01:26 +0000 |
commit | aee1d1e96b100c503344d86779ece72325ac17e9 (patch) | |
tree | f331d66e3f67bd12ef8efa5627e14623bec56d5b /util/cmake | |
parent | 404d0b59754a4568264c285e7bf517d1c01d8228 (diff) |
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 <simon.hausmann@qt.io>
Diffstat (limited to 'util/cmake')
-rwxr-xr-x | util/cmake/pro2cmake.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 0e4ed74362..52e67e482d 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 ') |