From 1fef03c0f04e86300bee5ff3f628752d9e27304d Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 10 Jul 2023 13:21:41 -0400 Subject: build: dependencies should come after link_with on link command This fixes regression caused by https://github.com/mesonbuild/meson/commit/3162b901cab46d66a30c66a4406195523714ecdc that changes the order in which libraries are put on the link command. In addition, that commit was wrong because libraries from dependencies were processed before process_compiler() is called, which that commit wanted to avoid. --- test cases/unit/113 complex link cases/meson.build | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test cases') diff --git a/test cases/unit/113 complex link cases/meson.build b/test cases/unit/113 complex link cases/meson.build index 31753edad..04e628177 100644 --- a/test cases/unit/113 complex link cases/meson.build +++ b/test cases/unit/113 complex link cases/meson.build @@ -47,3 +47,14 @@ s1 = static_library('t7-s1', 's1.c') s2 = static_library('t7-s2', 's2.c') s3 = static_library('t7-s3', 's3.c', link_with: [s1, s2], install: true) e = executable('t7-e1', 'main.c', link_with: s3) + +# Regression test: s3 should come last in the linker command. This seems to be +# required for at least backward compatibility reasons: +# https://github.com/mesonbuild/meson/pull/11957#issuecomment-1629243208 +s1 = static_library('t8-s1', 's1.c') +s2 = static_library('t8-s2', 's2.c') +s3 = static_library('t8-s3', 's3.c') +e = executable('t8-e1', 'main.c', + link_with: [s1, s2], + dependencies: declare_dependency(link_with: s3), +) -- cgit v1.2.3