Do not export empty scopes to the build environment

This commit is contained in:
Ivan Kravets
2022-05-26 19:15:15 +03:00
parent ea94f65159
commit 460a983ab2

View File

@@ -453,11 +453,17 @@ class LibBuilderBase:
def build(self): def build(self):
libs = [] libs = []
shared_scopes = ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS")
for lb in self.depbuilders: for lb in self.depbuilders:
libs.extend(lb.build()) libs.extend(lb.build())
# copy shared information to self env # copy shared information to self env
for key in ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"): self.env.PrependUnique(
self.env.PrependUnique(**{key: lb.env.get(key)}) **{
scope: lb.env.get(scope)
for scope in shared_scopes
if lb.env.get(scope)
}
)
for lb in self._circular_deps: for lb in self._circular_deps:
self.env.PrependUnique(CPPPATH=lb.get_include_dirs()) self.env.PrependUnique(CPPPATH=lb.get_include_dirs())
@@ -472,8 +478,13 @@ class LibBuilderBase:
for lb in self.env.GetLibBuilders(): for lb in self.env.GetLibBuilders():
if self == lb or not lb.is_built: if self == lb or not lb.is_built:
continue continue
for key in ("CPPPATH", "LIBPATH", "LIBS", "LINKFLAGS"): self.env.PrependUnique(
self.env.PrependUnique(**{key: lb.env.get(key)}) **{
scope: lb.env.get(scope)
for scope in shared_scopes
if lb.env.get(scope)
}
)
do_not_archive = not self.lib_archive do_not_archive = not self.lib_archive
if not do_not_archive: if not do_not_archive: