summaryrefslogtreecommitdiff
path: root/test cases/common/173 as-needed/meson.build
blob: 1c2f632b494652de146ea48872e4857965707eb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
project('as-needed test', 'cpp')

# Idea behind this test is to have -Wl,--as-needed prune
# away unneeded linkages, which would otherwise cause global
# static initialiser side-effects to set a boolean to true.

# Credits for portable ISO C++ idea go to sarum9in

libA = library('A', 'libA.cpp')
libB = library('B', 'libB.cpp', link_with : libA)

main_exe = executable('C', 'main.cpp', link_with : [libA, libB])
test('main test', main_exe)

# Since Sonoma / Xcode 15 the macos linker considers the dependency via the
# initializer sufficient to pull in the other other library. There's no good
# way to detect the linker version here, so just skip the on macos.
if host_machine.system() == 'darwin'
    error('MESON_SKIP_TEST: the macos linker is too smart for this test')
endif