Use flatten for link targets. Fixes #1764

pull/1735/head
Dylan Baker 8 years ago
parent e419198ff8
commit e2567386f1
  1. 4
      docs/markdown/Reference-manual.md
  2. 8
      mesonbuild/build.py
  3. 6
      test cases/common/150 nested links/meson.build
  4. 3
      test cases/common/150 nested links/xephyr.c

@ -228,8 +228,8 @@ With the Ninja backend, Meson will create a build-time [order-only dependency](h
Executable supports the following keyword arguments. Note that just like the positional arguments above, these keyword arguments can also be passed to [shared and static libraries](#library).
- `link_with`, one or more shared or static libraries (built by this project) that this target should be linked with
- `link_whole` links all contents of the given static libraries whether they are used by not, equivalent to the `-Wl,--whole-archive` argument flag of GCC, available since 0.40.0
- `link_with`, one or more shared or static libraries (built by this project) that this target should be linked with, If passed a list this list will be flattened as of 0.41.0.
- `link_whole` links all contents of the given static libraries whether they are used by not, equivalent to the `-Wl,--whole-archive` argument flag of GCC, available since 0.40.0. As of 0.41.0 if passed a list that list will be flattened.
- `<languagename>_pch` precompiled header file to use for the given language
- `<languagename>_args` compiler flags to use for the given language; eg: `cpp_args` for C++
- `link_args` flags to use during linking. You can use UNIX-style flags here for all platforms.

@ -813,9 +813,7 @@ You probably should put it in link_with instead.''')
return self.external_deps
def link(self, target):
if not isinstance(target, list):
target = [target]
for t in target:
for t in flatten(target):
if hasattr(t, 'held_object'):
t = t.held_object
if not isinstance(t, (StaticLibrary, SharedLibrary)):
@ -829,9 +827,7 @@ You probably should put it in link_with instead.''')
self.link_targets.append(t)
def link_whole(self, target):
if not isinstance(target, list):
target = [target]
for t in target:
for t in flatten(target):
if hasattr(t, 'held_object'):
t = t.held_object
if not isinstance(t, StaticLibrary):

@ -0,0 +1,6 @@
project('test', 'c')
libxserver_dri3 = []
libxserver = [ libxserver_dri3 ]
executable('Xephyr', 'xephyr.c', link_with: [ libxserver ])

@ -0,0 +1,3 @@
int main() {
return 0;
}
Loading…
Cancel
Save