From 6e9a2dd3c6994d83f1a24dadba0ecc1350e441dd Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Thu, 17 Jan 2019 17:14:19 +0100 Subject: [PATCH] CMake: pro2cmake.py: Visit scopes depth-first for include resolution This avoids some includes being done several times: We used to generate scopes for the include files, add them to our current scope and then traverse the children of the current scope. Switch the order to avoid traversing the newly added scopes twice. Change-Id: Icb9c53c9f54772d3305e0fb121824c23d5469e09 Reviewed-by: Frederik Gladhorn --- util/cmake/pro2cmake.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index d99863cbcc3..e37c765f7ae 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -884,6 +884,9 @@ def generate_cmakelists(scope: Scope) -> None: def do_include(scope: Scope, *, debug: bool = False) -> None: + for c in scope.children(): + do_include(c) + for i in scope.getIncludes(): dir = scope.basedir() include_file = i @@ -906,9 +909,6 @@ def do_include(scope: Scope, *, debug: bool = False) -> None: scope.merge(include_scope) - for c in scope.children(): - do_include(c) - def main() -> None: args = _parse_commandline()