From 9159a555f48fe9ea06d72227e94c6006c3646ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20K=C3=B6hne?= <kai.koehne@qt.io> Date: Thu, 24 Mar 2022 14:01:41 +0100 Subject: [PATCH] Replace also versioned commands --- qt_example_cmakelists_cleanup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qt_example_cmakelists_cleanup.py b/qt_example_cmakelists_cleanup.py index 2f6af38..a194286 100644 --- a/qt_example_cmakelists_cleanup.py +++ b/qt_example_cmakelists_cleanup.py @@ -22,8 +22,11 @@ def simplify(content): # Remove CMAKE_INCLUDE_CURRENT_DIR content = re.sub(r"set\(CMAKE_INCLUDE_CURRENT_DIR ON\)\n\n", "", content) + # Use non-versioned commands + content = re.sub(r"qt6_(\w+\()", r"qt_\1", content) + # Combine find_package(Qt6 calls) - find_package_regex = re.compile(r"find_package\(Qt6 COMPONENTS (.*)\)") + find_package_regex = re.compile(r"find_package\(Qt6 COMPONENTS (.*)(?:REQUIRED)?\)") qt_components = " ".join(find_package_regex.findall(content)) qt_components = " ".join(sorted(qt_components.split())) content = find_package_regex.sub(r"find_package(Qt6 REQUIRED COMPONENTS {})".format(qt_components), content, count=1) -- GitLab