meson.build 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. project('library versions', 'c')
  2. some = shared_library('some', 'lib.c',
  3. version : '1.2.3',
  4. soversion : '0',
  5. install : true)
  6. noversion = shared_library('noversion', 'lib.c',
  7. install : true)
  8. onlyversion = shared_library('onlyversion', 'lib.c',
  9. version : '1.4.5',
  10. install : true)
  11. onlysoversion = shared_library('onlysoversion', 'lib.c',
  12. # Also test that int soversion is acceptable
  13. soversion : 5,
  14. install : true)
  15. # Hack to make the executables below depend on the shared libraries above
  16. # without actually adding them as `link_with` dependencies since we want to try
  17. # linking to them with -lfoo linker arguments.
  18. out = custom_target('library-dependency-hack',
  19. input : 'exe.orig.c',
  20. output : 'exe.c',
  21. depends : [some, noversion, onlyversion, onlysoversion],
  22. command : ['cp', '@INPUT@', '@OUTPUT@'])
  23. # Manually test if the linker can find the above libraries
  24. # i.e., whether they were generated with the right naming scheme
  25. test('manually linked 1', executable('manuallink1', out,
  26. link_args : ['-L.', '-lsome']))
  27. test('manually linked 2', executable('manuallink2', out,
  28. link_args : ['-L.', '-lnoversion']))
  29. test('manually linked 3', executable('manuallink3', out,
  30. link_args : ['-L.', '-lonlyversion']))
  31. test('manually linked 4', executable('manuallink4', out,
  32. link_args : ['-L.', '-lonlysoversion']))
  33. shared_module('module', 'lib.c', install : true)