Debian Codegraph @

vendored-meson/meson/test cases/common/173 as-needed/meson.build

raw
1 project('as-needed test', 'cpp')
2
3 # Idea behind this test is to have -Wl,--as-needed prune
4 # away unneeded linkages, which would otherwise cause global
5 # static initialiser side-effects to set a boolean to true.
6
7 # Credits for portable ISO C++ idea go to sarum9in
8
9 libA = library('A', 'libA.cpp')
10 libB = library('B', 'libB.cpp', link_with : libA)
11
12 main_exe = executable('C', 'main.cpp', link_with : [libA, libB])
13 test('main test', main_exe)
14
15 # Since Sonoma / Xcode 15 the macos linker considers the dependency via the
16 # initializer sufficient to pull in the other other library. There's no good
17 # way to detect the linker version here, so just skip the on macos.
18 if host_machine.system() == 'darwin'
19 error('MESON_SKIP_TEST: the macos linker is too smart for this test')
20 endif