summaryrefslogtreecommitdiffstats
path: root/util/cmake/pro2cmake.py
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-03-10 14:49:46 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-03-12 11:41:29 +0100
commitd2419b0d8c449bc60bc7abad3dab129dd4e8a2d0 (patch)
tree1db2b91adb510c0380211adfdca0bfe8d0cb95c7 /util/cmake/pro2cmake.py
parent14546d1816a877690cda71f02c275303ef42afa8 (diff)
CMake: pro2cmake: Handle LIBS_SUFFIX define correctly
Matches the LIBS_SUFFIX define we use in Android conditions and replaces it with a sane amount of escaped characters. Change-Id: I7d870f992c70b105dd80b6fa94f87d3fa5644006 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'util/cmake/pro2cmake.py')
-rwxr-xr-xutil/cmake/pro2cmake.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index de2f175953..7bc29990c5 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -1956,6 +1956,18 @@ def write_defines(
d.replace('=\\\\\\"$$PWD/\\\\\\"', '="${CMAKE_CURRENT_SOURCE_DIR}/"') for d in defines
]
+ # Handle LIBS_SUFFIX='\\"_$${QT_ARCH}.so\\"'.
+ # The escaping of backslashes is still needed even if it's a raw
+ # string, because backslashes have a special meaning for regular
+ # expressions (escape next char). So we actually expect to match
+ # 2 backslashes in the input string.
+ pattern = r"""([^ ]+)='\\\\"([^ ]*)\\\\"'"""
+
+ # Replace with regular quotes, CMake will escape the quotes when
+ # passing the define to the compiler.
+ replacement = r'\1="\2"'
+ defines = [re.sub(pattern, replacement, d) for d in defines]
+
if "qml_debug" in scope.get("CONFIG"):
defines.append("QT_QML_DEBUG")