From 83459829f24624e3cee20a7199af5c69e9678b69 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 19 Oct 2018 10:44:52 +0200 Subject: Suggest override variable (config.x) when tool is not found --- build2/cc/guess.cxx | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'build2/cc/guess.cxx') diff --git a/build2/cc/guess.cxx b/build2/cc/guess.cxx index e9f85e3..e75a6ee 100644 --- a/build2/cc/guess.cxx +++ b/build2/cc/guess.cxx @@ -288,13 +288,22 @@ namespace build2 // Allowed to change pre if succeeds. // static guess_result - guess (lang, const path& xc, string& pre) + guess (lang, const string& xv, const path& xc, string& pre) { tracer trace ("cc::guess"); guess_result r; - process_path xp (run_search (xc, false /* init */)); // Note: cached. + process_path xp; + { + auto df = make_diag_frame ( + [&xv](const diag_record& dr) + { + dr << info << "use " << xv << " to override"; + }); + + xp = run_search (xc, false /* init */); // Note: cached. + } // Start with -v. This will cover gcc and clang. // @@ -1450,6 +1459,7 @@ namespace build2 const compiler_info& guess (lang xl, + const string& xv, const path& xc, const strings* c_po, const strings* x_po, const strings* c_co, const strings* x_co, @@ -1485,16 +1495,17 @@ namespace build2 if (!type.empty ()) { - gr = guess (xl, xc, type); + gr = guess (xl, xv, xc, type); if (gr.empty ()) - warn << xc << " name looks like " << type << " but it is not"; + warn << xc << " looks like " << type << " but it is not" << + info << "use " << xv << " to override"; type.clear (); } if (gr.empty ()) - gr = guess (xl, xc, type); + gr = guess (xl, xv, xc, type); if (gr.empty ()) fail << "unable to guess " << xl << " compiler type of " << xc; -- cgit v1.1