From b0dbfc3094b9c3950643fc5acf7020e33825dd3e Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 9 Sep 2019 14:29:12 +0200 Subject: [PATCH] Skip converting certain projects when they are passed to pro2cmake Specifically skip cmake tests projects (because they are only needed when Qt is built with qmake). Also skip test qmake projects in qmake's test suite. We might find more tests to skip in the future. Change-Id: I4c3a42db669b31e81fd06206652371b6a70fd8ce Reviewed-by: Simon Hausmann Reviewed-by: Qt CMake Build Bot --- util/cmake/pro2cmake.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 91e7f5f5f4..e2ac9ef4b0 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -2485,6 +2485,23 @@ def copy_generated_file_to_final_location(scope: Scope, keep_temporary_files=Fal os.remove(scope.generated_cmake_lists_path) +def should_convert_project(project_file_path: str = '') -> bool: + qmake_conf_path = find_qmake_conf(project_file_path) + qmake_conf_dir_path = os.path.dirname(qmake_conf_path) + + project_relative_path = os.path.relpath(project_file_path, qmake_conf_dir_path) + + # Skip cmake auto tests, they should not be converted. + if project_relative_path.startswith('tests/auto/cmake'): + return False + + # Skip qmake testdata projects. + if project_relative_path.startswith('tests/auto/tools/qmake/testdata'): + return False + + return True + + def main() -> None: args = _parse_commandline() @@ -2498,6 +2515,11 @@ def main() -> None: if new_current_dir: os.chdir(new_current_dir) + project_file_absolute_path = os.path.abspath(file) + if not should_convert_project(project_file_absolute_path): + print('Skipping conversion of project: "{}"'.format(project_file_absolute_path)) + continue + parseresult = parseProFile(file_relative_path, debug=debug_parsing) if args.debug_parse_result or args.debug: