From 088a60c512aff26eeb026c516d0afe724880cb2b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 7 Apr 2015 10:47:28 +0200 Subject: Provide more convenient access to root scope --- build/config/operation.cxx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'build/config') diff --git a/build/config/operation.cxx b/build/config/operation.cxx index 6886752..6f5beba 100644 --- a/build/config/operation.cxx +++ b/build/config/operation.cxx @@ -65,8 +65,9 @@ namespace build } static void - save_config (const path& out_root) + save_config (scope& r) { + const path& out_root (r.path ()); path f (out_root / config_file); if (verb >= 1) @@ -85,8 +86,6 @@ namespace build // Save all the variables in the config namespace that are set // on the project's root scope. // - scope& r (scopes.find (out_root)); - for (auto p (r.variables.find_namespace ("config")); p.first != p.second; ++p.first) @@ -135,10 +134,13 @@ namespace build for (void* v: ts) { target& t (*static_cast (v)); - scope& s (scopes.find (t.dir)); + scope* rs (t.root_scope ()); + + if (rs == nullptr) + fail << "out of project target " << t; - const path& out_root (s["out_root"].as ()); - const path& src_root (s["src_root"].as ()); + const path& out_root (rs->path ()); + const path& src_root (rs->src_path ()); // Make sure the directories exist. // @@ -163,7 +165,7 @@ namespace build // Save config.build. // - save_config (out_root); + save_config (*rs); } else { -- cgit v1.1