From 9162aa5da9cd29d1231bf268dcee349b6bc25dd3 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Thu, 17 Jan 2019 13:41:17 +0100 Subject: [PATCH] CMake: pro2cmake: fix include file handling Do not include the same file over and over again... Change-Id: Ia0748b9ebe58388549ba23ec7e24ce3d9b738987 Reviewed-by: Frederik Gladhorn Reviewed-by: Simon Hausmann --- util/cmake/pro2cmake.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 80a10bd944a..33b8ffb6c09 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -346,6 +346,7 @@ class Scope: c.dump(indent=indent + 1) def get(self, key: str, default=None) -> typing.List[str]: + assert key != '_INCLUDED' # Special case things that may not recurse! result = [] # type: typing.List[str] if self._parent: @@ -378,6 +379,12 @@ class Scope: return self.getString('TARGET') \ or os.path.splitext(os.path.basename(self.file()))[0] + def getIncludes(self) -> typing.List[str]: + result = [] + for op in self._operations.get('_INCLUDED', []): + result = op.process(result) + return result + class QmakeParser: def __init__(self, *, debug: bool = False) -> None: @@ -844,7 +851,7 @@ def generate_cmakelists(scope: Scope) -> None: def do_include(scope: Scope, *, debug: bool = False) -> None: - for i in scope.get('_INCLUDED', []): + for i in scope.getIncludes(): dir = scope.basedir() include_file = map_to_file(i, dir, scope.currentdir(), want_absolute_path=True)