summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2019-11-08 10:37:38 +0100
committerLeander Beernaert <leander.beernaert@qt.io>2019-11-08 09:56:30 +0000
commit706e7fdb0ca5ab2beabecf39809c032bd98ac84a (patch)
treeeb35f424bb0a814955592fff42db317c3c29c3c6
parent512aae3abea65dcdc1e3d667eab73b8f41cf5601 (diff)
Add generic lessThan|greaterThan|equal condition map to pro2cmake.py
Change-Id: Ib611aa9a808a05b38a83bd3fd7d95081bdf6e256 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rwxr-xr-xutil/cmake/pro2cmake.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index 07f1fe26df..87e593a423 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -1238,6 +1238,24 @@ def map_condition(condition: str) -> str:
pattern = r"(equals|greaterThan|lessThan)\(WINDOWS_SDK_VERSION,[ ]*([0-9]+)\)"
condition = re.sub(pattern, windows_sdk_version_handler, condition)
+ # Generic lessThan|equals|lessThan()
+
+ def generic_version_handler(match_obj: Match):
+ operator = match_obj.group(1)
+ if operator == "equals":
+ operator = "EQUAL"
+ elif operator == "greaterThan":
+ operator = "GREATER"
+ elif operator == "lessThan":
+ operator = "LESS"
+
+ variable = match_obj.group(2)
+ version = match_obj.group(3)
+ return f"({variable} {operator} {version})"
+
+ pattern = r"(equals|greaterThan|lessThan)\((.+),[ ]*([0-9]+)\)"
+ condition = re.sub(pattern, generic_version_handler, condition)
+
# Handle if(...) conditions.
condition = unwrap_if(condition)