aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/ninjabackend.py6
-rw-r--r--mesonbuild/backend/vs2010backend.py6
-rw-r--r--mesonbuild/compilers.py13
3 files changed, 21 insertions, 4 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 8a2ee9a..9a48c4e 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -2294,11 +2294,13 @@ rule FORTRAN_DEP_HACK
commands += target.link_args
# External deps must be last because target link libraries may depend on them.
for dep in target.get_external_deps():
- commands += dep.get_link_args()
+ # Extend without reordering or de-dup to preserve `-L -l` sets
+ # https://github.com/mesonbuild/meson/issues/1718
+ commands.extend_direct(dep.get_link_args())
for d in target.get_dependencies():
if isinstance(d, build.StaticLibrary):
for dep in d.get_external_deps():
- commands += dep.get_link_args()
+ commands.extend_direct(dep.get_link_args())
# Add link args for c_* or cpp_* build options. Currently this only
# adds c_winlibs and cpp_winlibs when building for Windows. This needs
# to be after all internal and external libraries so that unresolved
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index d4a7a19..57b0437 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -908,11 +908,13 @@ class Vs2010Backend(backends.Backend):
extra_link_args += target.link_args
# External deps must be last because target link libraries may depend on them.
for dep in target.get_external_deps():
- extra_link_args += dep.get_link_args()
+ # Extend without reordering or de-dup to preserve `-L -l` sets
+ # https://github.com/mesonbuild/meson/issues/1718
+ extra_link_args.extend_direct(dep.get_link_args())
for d in target.get_dependencies():
if isinstance(d, build.StaticLibrary):
for dep in d.get_external_deps():
- extra_link_args += dep.get_link_args()
+ extra_link_args.extend_direct(dep.get_link_args())
# Add link args for c_* or cpp_* build options. Currently this only
# adds c_winlibs and cpp_winlibs when building for Windows. This needs
# to be after all internal and external libraries so that unresolved
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 80d12a0..2b54cc8 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -465,6 +465,19 @@ class CompilerArgs(list):
self.insert(i + 1, '-Wl,--end-group')
return self.compiler.unix_args_to_native(self)
+ def append_direct(self, arg):
+ '''
+ Append the specified argument without any reordering or de-dup
+ '''
+ super().append(arg)
+
+ def extend_direct(self, iterable):
+ '''
+ Extend using the elements in the specified iterable without any
+ reordering or de-dup
+ '''
+ super().extend(iterable)
+
def __add__(self, args):
new = CompilerArgs(self, self.compiler)
new += args