aboutsummaryrefslogtreecommitdiff
path: root/build2/cli
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-04-11 17:37:29 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-04-11 17:37:29 +0200
commit8ee02c5d40006d52d0048a748a695d589b3627cb (patch)
tree29824aabedc6387606e78318656d235318a62d9a /build2/cli
parent6d61a95027c0e199495f083b393d740933f41e82 (diff)
Simplify unconfigured module interface
Diffstat (limited to 'build2/cli')
-rw-r--r--build2/cli/module.cxx22
1 files changed, 8 insertions, 14 deletions
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<string> (p.first) == cli);
+ auto p (config::required (root, "config.cli", cli));
+ assert (p.second && cast<path> (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<string> (p.first).c_str ();
+ cli = cast<path> (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;
}