From 650d61845b3f61e9596a8a2dc97458998ba26013 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 8 Jul 2015 14:40:15 +0200 Subject: Implement automatic amalgamation discovery --- build/config/operation.cxx | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'build/config') diff --git a/build/config/operation.cxx b/build/config/operation.cxx index e6c258c..300dd22 100644 --- a/build/config/operation.cxx +++ b/build/config/operation.cxx @@ -85,9 +85,10 @@ namespace build << "# feel free to edit." << endl << "#" << endl; - if (auto v = root.vars["amalgamation"]) + auto av = root.vars["amalgamation"]; + if (av && !av.empty ()) { - const dir_path& d (v.as ()); + const dir_path& d (av.as ()); ofs << "# Base configuration inherited from " << d << endl << "#" << endl; @@ -276,20 +277,20 @@ namespace build // Create and bootstrap subproject's root scope. // dir_path out_nroot (out_root / n.dir); - dir_path src_nroot (src_root / n.dir); - scope& nroot (create_root (out_nroot, src_nroot)); + // The same logic to src_root as in create_bootstrap_inner(). + // + scope& nroot (create_root (out_nroot, dir_path ())); bootstrap_out (nroot); - // Check if the bootstrap process changed src_root. - // - const dir_path& p (nroot.vars["src_root"].as ()); + auto val (nroot.assign ("src_root")); - if (src_nroot != p) - fail << "bootstrapped src_root " << p << " does not match " - << "subproject " << src_nroot; + if (!val) + val = is_src_root (out_nroot) + ? out_nroot + : (src_root / n.dir); - nroot.src_path_ = &p; + nroot.src_path_ = &val.as (); bootstrap_src (nroot); -- cgit v1.1