aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-05-09 13:31:16 -0700
committerDylan Baker <dylan@pnwbakers.com>2017-05-11 09:57:38 -0700
commite2567386f108c17704a9b300f56c0f2f2c0b4b54 (patch)
tree432bbb680898de38d932ba8d405e127b918f11f9
parente419198ff879f74663a7c4d71f2a24f125d27de1 (diff)
downloadmeson-e2567386f108c17704a9b300f56c0f2f2c0b4b54.zip
meson-e2567386f108c17704a9b300f56c0f2f2c0b4b54.tar.gz
meson-e2567386f108c17704a9b300f56c0f2f2c0b4b54.tar.bz2
Use flatten for link targets. Fixes #1764
-rw-r--r--docs/markdown/Reference-manual.md4
-rw-r--r--mesonbuild/build.py8
-rw-r--r--test cases/common/150 nested links/meson.build6
-rw-r--r--test cases/common/150 nested links/xephyr.c3
4 files changed, 13 insertions, 8 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index c64419b..7e46da1 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -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.
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 0d58394..41fd8c1 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -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):
diff --git a/test cases/common/150 nested links/meson.build b/test cases/common/150 nested links/meson.build
new file mode 100644
index 0000000..32cf668
--- /dev/null
+++ b/test cases/common/150 nested links/meson.build
@@ -0,0 +1,6 @@
+project('test', 'c')
+
+libxserver_dri3 = []
+libxserver = [ libxserver_dri3 ]
+
+executable('Xephyr', 'xephyr.c', link_with: [ libxserver ])
diff --git a/test cases/common/150 nested links/xephyr.c b/test cases/common/150 nested links/xephyr.c
new file mode 100644
index 0000000..33c14ce
--- /dev/null
+++ b/test cases/common/150 nested links/xephyr.c
@@ -0,0 +1,3 @@
+int main() {
+ return 0;
+}