Change the order of link_args when cross_compiling with ninja.

A user may want to add libraries to link with in the (c|cpp)_link_args
property of the cross-compile file.
Those libraries should be at the end of the command line due to reference
resolution mechanism of the compiler.

By moving the cross_args after LINK_ARGS we are sure that specific
cross-compilation libraries are at the end of the command line.

See [github PR #1363](https://github.com/mesonbuild/meson/pull/1363) to
have the context of this change.
pull/1363/head
Matthieu Gautier 8 years ago
parent 0b2146c8f7
commit fab04b1fbe
  1. 4
      mesonbuild/backend/ninjabackend.py

@ -1276,10 +1276,10 @@ int dummy;
if mesonlib.is_windows(): if mesonlib.is_windows():
command_template = ''' command = {executable} @$out.rsp command_template = ''' command = {executable} @$out.rsp
rspfile = $out.rsp rspfile = $out.rsp
rspfile_content = {cross_args} $ARGS {output_args} $in $LINK_ARGS $aliasing rspfile_content = $ARGS {output_args} $in $LINK_ARGS {cross_args} $aliasing
''' '''
else: else:
command_template = ' command = {executable} {cross_args} $ARGS {output_args} $in $LINK_ARGS $aliasing\n' command_template = ' command = {executable} $ARGS {output_args} $in $LINK_ARGS {cross_args} $aliasing\n'
command = command_template.format( command = command_template.format(
executable=' '.join(compiler.get_linker_exelist()), executable=' '.join(compiler.get_linker_exelist()),
cross_args=' '.join(cross_args), cross_args=' '.join(cross_args),

Loading…
Cancel
Save