From 8ee02c5d40006d52d0048a748a695d589b3627cb Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 11 Apr 2016 17:37:29 +0200 Subject: Simplify unconfigured module interface --- build2/cli/module.cxx | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'build2/cli') diff --git a/build2/cli/module.cxx b/build2/cli/module.cxx index 7b98e93..bc6e13f 100644 --- a/build2/cli/module.cxx +++ b/build2/cli/module.cxx @@ -87,7 +87,7 @@ namespace build2 // Don't re-run tests if the configuration says we are unconfigured. // if (optional && config::unconfigured (root, "config.cli")) - return false; + return false; // config.cli // @@ -96,9 +96,9 @@ namespace build2 // Return version or empty string if unable to execute (e.g., // the cli executable is not found). // - auto test = [optional] (const char* cli) -> string + auto test = [optional] (const path& cli) -> string { - const char* args[] = {cli, "--version", nullptr}; + const char* args[] = {cli.string ().c_str (), "--version", nullptr}; if (verb >= 2) print_process (args); @@ -145,7 +145,7 @@ namespace build2 }; string ver; - const char* cli ("cli"); // Default. + path cli ("cli"); // Default. if (optional) { @@ -169,19 +169,19 @@ namespace build2 } else { - auto p (config::required (root, "config.cli", path (cli))); - assert (p.second && cast (p.first) == cli); + auto p (config::required (root, "config.cli", cli)); + assert (p.second && cast (p.first) == cli); } } else { - auto p (config::required (root, "config.cli", path (cli))); + auto p (config::required (root, "config.cli", cli)); // If we actually set a new value, test it by trying to execute. // if (p.second) { - cli = cast (p.first).c_str (); + cli = cast (p.first); ver = test (cli); if (ver.empty ()) @@ -189,12 +189,6 @@ namespace build2 } } - // Clear the unconfigured flag, if any. - // - // @@ Get rid of needing to do this. - // - config::unconfigured (root, "config.cli", false); - if (!ver.empty () && verb >= 2) text << cli << " " << ver; } -- cgit v1.1