diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-04-01 12:18:40 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-04-01 12:18:40 +0200 |
commit | e0de4f26fcf598b4f6beaa2847c4d43a4c761f5b (patch) | |
tree | 42e79e141d5b3488cb98843589a68001c875ed01 /build/config | |
parent | 0dee00f28e623830e816c4002c8004c86055df85 (diff) |
Warn about configured/command line value mismatch
Also store configured but unspecified values
Diffstat (limited to 'build/config')
-rw-r--r-- | build/config/operation.cxx | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/build/config/operation.cxx b/build/config/operation.cxx index c6a9444..5b9cc5c 100644 --- a/build/config/operation.cxx +++ b/build/config/operation.cxx @@ -82,30 +82,43 @@ namespace build ofs.exceptions (ofstream::failbit | ofstream::badbit); - // Save all the variables in the config. namespace that are set + // Save all the variables in the config namespace that are set // on the project's root scope. // scope& r (scopes.find (out_root)); - /* - r.variables["config"] = "default interactive"; - r.variables["config.cxx"] = "g++-4.9"; - r.variables["config.cxx.options"] = "-O3 -g"; - */ - for (auto p (r.variables.find_namespace ("config")); p.first != p.second; ++p.first) { const variable& var (p.first->first); - const value& val (*p.first->second); + const value_ptr& pval (p.first->second); - //@@ TODO: assuming list + // Warn the user if the value that we are saving differs + // from the one they specified on the command line. // - const list_value& lv (dynamic_cast<const list_value&> (val)); + if (auto gval = (*global_scope)[var]) + { + if (!pval || !pval->compare (gval.as<const value&> ())) + warn << "variable " << var.name << " configured value " + << "differs from command line value" << + info << "reconfigure the project to use command line value"; + } - ofs << var.name << " = " << lv.data << endl; - text << var.name << " = " << lv.data; + if (pval) + { + //@@ TODO: assuming list + // + const list_value& lv (dynamic_cast<const list_value&> (*pval)); + + ofs << var.name << " = " << lv.data << endl; + text << var.name << " = " << lv.data; + } + else + { + ofs << var.name << " =" << endl; // @@ TODO: [undefined] + text << var.name << " = [undefined]"; + } } } catch (const ios_base::failure&) |