From 06bfc2dab61c5bf79265a8db777b02732ee86ecf Mon Sep 17 00:00:00 2001 From: "Michael Hirsch, Ph.D" <10931741+scivision@users.noreply.github.com> Date: Thu, 2 May 2019 16:26:51 -0400 Subject: per-target manual specification of link_language --- docs/markdown/snippets/link_language.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 docs/markdown/snippets/link_language.md (limited to 'docs/markdown/snippets') diff --git a/docs/markdown/snippets/link_language.md b/docs/markdown/snippets/link_language.md new file mode 100644 index 0000000..28ebe8b --- /dev/null +++ b/docs/markdown/snippets/link_language.md @@ -0,0 +1,10 @@ +## New target keyword argument: `link_language` +There may be situations for which the user wishes to manually specify the linking language. +For example, a C++ target may link C, Fortran, etc. and perhaps the automatic detection in Meson does not pick the desired compiler. +The user can manually choose the linker by language per-target like this example of a target where one wishes to link with the Fortran compiler: +```meson +executable(..., link_language : 'fortran') +``` + +A specific case this option fixes is where for example the main program is Fortran that calls C and/or C++ code. +The automatic language detection of Meson prioritizes C/C++, and so an compile-time error results like `undefined reference to main`, because the linker is C or C++ instead of Fortran, which is fixed by this per-target override. -- cgit v1.1