summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2019-01-17 13:41:17 +0100
committerTobias Hunger <tobias.hunger@qt.io>2019-01-18 08:50:40 +0000
commit9162aa5da9cd29d1231bf268dcee349b6bc25dd3 (patch)
treeb10b936a6d1994ee03697d33f368cb19e860ab93 /util
parent448ca92053d62b7fd3f820f00098702c3c4bd09f (diff)
CMake: pro2cmake: fix include file handling
Do not include the same file over and over again... Change-Id: Ia0748b9ebe58388549ba23ec7e24ce3d9b738987 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'util')
-rwxr-xr-xutil/cmake/pro2cmake.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index 80a10bd944..33b8ffb6c0 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)