Debian Codegraph @

vendored-meson/meson/test cases/linuxlike/7 library versions/meson.build

raw
1 project('library versions', 'c')
2
3 if host_machine.system() == 'cygwin'
4 error('MESON_SKIP_TEST linuxlike soversions not supported on Cygwin.')
5 endif
6
7 some = shared_library('some', 'lib.c',
8 version : '1.2.3',
9 soversion : '0',
10 install : true)
11
12 noversion = shared_library('noversion', 'lib.c',
13 install : true)
14
15 onlyversion = shared_library('onlyversion', 'lib.c',
16 version : '1.4.5',
17 install : true)
18
19 onlysoversion = shared_library('onlysoversion', 'lib.c',
20 # Also test that int soversion is acceptable
21 soversion : 5,
22 install : true)
23
24 # Hack to make the executables below depend on the shared libraries above
25 # without actually adding them as `link_with` dependencies since we want to try
26 # linking to them with -lfoo linker arguments.
27 out = custom_target('library-dependency-hack',
28 input : 'exe.orig.c',
29 output : 'exe.c',
30 depends : [some, noversion, onlyversion, onlysoversion],
31 command : ['cp', '@INPUT@', '@OUTPUT@'])
32
33 # Need to add this manually because Meson can't add it automatically because
34 # it doesn't know that we are linking to libraries in the build directory.
35 rpath_dir = meson.current_build_dir()
36
37 # Manually test if the linker can find the above libraries
38 # i.e., whether they were generated with the right naming scheme
39 test('manually linked 1', executable('manuallink1', out,
40 link_args : ['-L.', '-lsome'],
41 build_rpath : rpath_dir))
42
43 test('manually linked 2', executable('manuallink2', out,
44 link_args : ['-L.', '-lnoversion'],
45 build_rpath : rpath_dir))
46
47 test('manually linked 3', executable('manuallink3', out,
48 link_args : ['-L.', '-lonlyversion'],
49 build_rpath : rpath_dir))
50
51 test('manually linked 4', executable('manuallink4', out,
52 link_args : ['-L.', '-lonlysoversion'],
53 build_rpath : rpath_dir))
54
55 shared_module('module', 'lib.c', install : true)