compilers: Add test for detecting libraries with externally supplied linker flags

pull/13047/head
L. E. Segovia 1 year ago committed by Dylan Baker
parent 8239912379
commit d86fce9594
  1. 2
      test cases/windows/22 msvc library argument order/lib/.gitignore
  2. 33
      test cases/windows/22 msvc library argument order/meson.build
  3. 9
      test cases/windows/22 msvc library argument order/nativefile.ini.in
  4. 3
      test cases/windows/22 msvc library argument order/source.c

@ -0,0 +1,33 @@
project('can-this-find-an-external-library', 'c')
cc = meson.get_compiler('c')
if cc.get_argument_syntax() != 'msvc'
error('MESON_SKIP_TEST: test is only relevant for msvc and clang-cl')
endif
# We need to conjure a static library for the current architecture
# Generate an object file manually.
run_command(
[
meson.get_compiler('c').cmd_array().get(-1),
'/nologo',
'/MDd',
'/Fo@0@'.format(meson.current_source_dir() / 'lib' / 'source.obj'),
'/c',
files('source.c'),
],
check: true
)
# Turn it into a library.
run_command(
[
find_program('LIB'),
'/OUT:@0@'.format(meson.current_source_dir() / 'lib' / 'conjured.lib'),
meson.current_source_dir() / 'lib' / 'source.obj',
],
check: true
)
# Ensure this library can be found
dep = cc.find_library('conjured', required: true)

@ -0,0 +1,9 @@
[constants]
common_args = ['-I@MESON_TEST_ROOT@/include']
common_link_args = ['-LIBPATH:@MESON_TEST_ROOT@/lib']
[properties]
c_args = common_args
cpp_args = common_args
c_link_args = common_link_args
cpp_link_args = common_link_args

@ -0,0 +1,3 @@
int func1_in_obj(void) {
return 0;
}
Loading…
Cancel
Save