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>
This commit is contained in:
parent
448ca92053
commit
9162aa5da9
@ -346,6 +346,7 @@ class Scope:
|
|||||||
c.dump(indent=indent + 1)
|
c.dump(indent=indent + 1)
|
||||||
|
|
||||||
def get(self, key: str, default=None) -> typing.List[str]:
|
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]
|
result = [] # type: typing.List[str]
|
||||||
|
|
||||||
if self._parent:
|
if self._parent:
|
||||||
@ -378,6 +379,12 @@ class Scope:
|
|||||||
return self.getString('TARGET') \
|
return self.getString('TARGET') \
|
||||||
or os.path.splitext(os.path.basename(self.file()))[0]
|
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:
|
class QmakeParser:
|
||||||
def __init__(self, *, debug: bool = False) -> None:
|
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:
|
def do_include(scope: Scope, *, debug: bool = False) -> None:
|
||||||
for i in scope.get('_INCLUDED', []):
|
for i in scope.getIncludes():
|
||||||
dir = scope.basedir()
|
dir = scope.basedir()
|
||||||
include_file = map_to_file(i, dir, scope.currentdir(),
|
include_file = map_to_file(i, dir, scope.currentdir(),
|
||||||
want_absolute_path=True)
|
want_absolute_path=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user