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 <frederik.gladhorn@qt.io>
This commit is contained in:
Tobias Hunger 2019-01-17 17:14:19 +01:00
parent 3f3517923e
commit 6e9a2dd3c6

View File

@ -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()