aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/backends.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-03-23 08:32:01 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-03-23 10:26:29 +0530
commit7f80f81ac9c00ed328566d9aec5140b4f9d1d21d (patch)
treebd5efaf8b6cde4683a1852f3f3759fbc46a727dc /mesonbuild/backend/backends.py
parent8482286236f6d91dfaa02e4254e0e15430e67eb2 (diff)
downloadmeson-7f80f81ac9c00ed328566d9aec5140b4f9d1d21d.zip
meson-7f80f81ac9c00ed328566d9aec5140b4f9d1d21d.tar.gz
meson-7f80f81ac9c00ed328566d9aec5140b4f9d1d21d.tar.bz2
Preserve the order of internal deps in a target
We were adding them to the CompilerArgs instance in the order in which they are specified, which is wrong because later dependencies would override previous ones. Add them in the reverse order instead. Closes https://github.com/mesonbuild/meson/issues/1495
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r--mesonbuild/backend/backends.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 5939488..fa9a82f 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -375,9 +375,11 @@ class Backend:
# Set -fPIC for static libraries by default unless explicitly disabled
if isinstance(target, build.StaticLibrary) and target.pic:
commands += compiler.get_pic_args()
- # Add compile args needed to find external dependencies
- # Link args are added while generating the link command
- for dep in target.get_external_deps():
+ # Add compile args needed to find external dependencies. Link args are
+ # added while generating the link command.
+ # NOTE: We must preserve the order in which external deps are
+ # specified, so we reverse the list before iterating over it.
+ for dep in reversed(target.get_external_deps()):
commands += dep.get_compile_args()
# Qt needs -fPIC for executables
# XXX: We should move to -fPIC for all executables