From 296575ba025ded840304c1e3b6365a6b6ee7ea48 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 26 Oct 2018 19:07:42 +0200 Subject: Add config.{c,cxx}.{id,version,target} configuration variables These variables allow overriding guessed compiler id/version/target, for example, in case of mis-guesses or when working with compilers that don't report their base (e.g., GCC, Clang) with -v/--version (common in the embedded space). --- build2/bin/guess.cxx | 18 +++++++++--------- build2/bin/init.cxx | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'build2/bin') diff --git a/build2/bin/guess.cxx b/build2/bin/guess.cxx index 78a1940..61c9f20 100644 --- a/build2/bin/guess.cxx +++ b/build2/bin/guess.cxx @@ -74,7 +74,7 @@ namespace build2 // that. // { - auto f = [] (string& l) -> guess_result + auto f = [] (string& l, bool) -> guess_result { // Normally GNU binutils ar --version output has a line that starts // with "GNU ar" and ends with the version. For example: @@ -155,7 +155,7 @@ namespace build2 // if (arr.empty ()) { - auto f = [] (string& l) -> guess_result + auto f = [] (string& l, bool) -> guess_result { return l.find (" ar ") != string::npos ? guess_result ("generic", move (l), semantic_version ()) @@ -185,7 +185,7 @@ namespace build2 // Binutils, LLVM, and FreeBSD. // { - auto f = [] (string& l) -> guess_result + auto f = [] (string& l, bool) -> guess_result { // The same story as with ar: normally starts with "GNU ranlib " // but can vary. @@ -218,7 +218,7 @@ namespace build2 // if (rlr.empty ()) { - auto f = [] (string& l) -> guess_result + auto f = [] (string& l, bool) -> guess_result { return l.find ("ranlib") != string::npos ? guess_result ("generic", move (l), semantic_version ()) @@ -285,7 +285,7 @@ namespace build2 // Version extraction is a @@ TODO. // { - auto f = [] (string& l) -> guess_result + auto f = [] (string& l, bool) -> guess_result { // Microsoft link.exe output starts with "Microsoft (R) ". // @@ -321,7 +321,7 @@ namespace build2 // if (r.empty ()) { - auto f = [] (string& l) -> guess_result + auto f = [] (string& l, bool) -> guess_result { // New ld64 has "PROJECT:ld64" in the first line (output to stderr), // for example: @@ -352,7 +352,7 @@ namespace build2 // if (r.empty ()) { - auto f = [] (string& l) -> guess_result + auto f = [] (string& l, bool) -> guess_result { // Unlike other LLVM tools (e.g., ar), the lld's version is printed // (to stderr) as: @@ -404,7 +404,7 @@ namespace build2 // // Version extraction is a @@ TODO. { - auto f = [] (string& l) -> guess_result + auto f = [] (string& l, bool) -> guess_result { // Binutils windres --version output has a line that starts with // "GNU windres " but search for "GNU ", similar to other tools. @@ -430,7 +430,7 @@ namespace build2 // if (r.empty ()) { - auto f = [] (string& l) -> guess_result + auto f = [] (string& l, bool) -> guess_result { if (l.compare (0, 14, "Microsoft (R) ") == 0) return guess_result ("msvc", move (l), semantic_version ()); diff --git a/build2/bin/init.cxx b/build2/bin/init.cxx index 9112773..6b3aeb3 100644 --- a/build2/bin/init.cxx +++ b/build2/bin/init.cxx @@ -262,7 +262,7 @@ namespace build2 s = run (3, ops.config_sub (), s.c_str (), - [] (string& l) {return move (l);}); + [] (string& l, bool) {return move (l);}); l5 ([&]{trace << "config.sub target: '" << s << "'";}); } -- cgit v1.1