| 1 |
project('link_early_args linking test', ['c', 'cpp']) |
| 2 |
|
| 3 |
message('host_machine ' + host_machine.system() + ' build_machine ' + build_machine.system()) |
| 4 |
|
| 5 |
if host_machine.system() == 'linux' |
| 6 |
c_link_early_args = '-Wl,--defsym=func_sym=func' |
| 7 |
cpp_link_early_args = '-Wl,--defsym=_Z11cppfunc_symv=_Z7cppfuncv' |
| 8 |
else |
| 9 |
message('unsupported on ' + host_machine.system()) |
| 10 |
c_link_early_args = '' |
| 11 |
cpp_link_early_args = '' |
| 12 |
endif |
| 13 |
|
| 14 |
if c_link_early_args != '' |
| 15 |
lib = static_library('mylib', 'libfile.c', install : false) |
| 16 |
exe = executable('prog', 'main.c', |
| 17 |
link_early_args : c_link_early_args, |
| 18 |
link_with : lib) |
| 19 |
|
| 20 |
test('runtest', exe) |
| 21 |
|
| 22 |
cpplib = static_library('mycpplib', 'cpplib.cpp') |
| 23 |
cppexe = executable('cppprog', 'cppmain.cpp', |
| 24 |
link_early_args : cpp_link_early_args, |
| 25 |
link_with : cpplib) |
| 26 |
test('cpptest', cppexe) |
| 27 |
endif |