diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-10 15:29:42 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-10 15:29:42 +0200 |
commit | 722cf9d345e38b6f5ff4ed538d1f68bc75b2ab51 (patch) | |
tree | c2a97aa7c5e54699fae778246187aa4b7ae8b32c /build/variable.cxx | |
parent | 650d61845b3f61e9596a8a2dc97458998ba26013 (diff) |
Implement automatic subproject discovery
Currently we only capture their directories without the project
names. We will need project names when we hook import search into
this.
Diffstat (limited to 'build/variable.cxx')
-rw-r--r-- | build/variable.cxx | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/build/variable.cxx b/build/variable.cxx index 6a40bc7..d00fcf6 100644 --- a/build/variable.cxx +++ b/build/variable.cxx @@ -15,6 +15,17 @@ namespace build // value_proxy // template <> + string& value_proxy:: + as<string&> () const + { + list_value& lv (as<list_value&> ()); + assert (lv.size () == 1); + name& n (lv.front ()); + assert (n.simple ()); + return n.value; + } + + template <> const string& value_proxy:: as<const string&> () const { @@ -26,11 +37,22 @@ namespace build const name& n (lv.front ()); - assert (n.type.empty () && n.dir.empty ()); + assert (n.simple ()); return n.value; } template <> + dir_path& value_proxy:: + as<dir_path&> () const + { + list_value& lv (as<list_value&> ()); + assert (lv.size () == 1); + name& n (lv.front ()); + assert (n.directory ()); + return n.dir; + } + + template <> const dir_path& value_proxy:: as<const dir_path&> () const { @@ -42,7 +64,10 @@ namespace build const name& n (lv.front ()); - assert (n.type.empty () && n.value.empty ()); + if (n.empty ()) + return empty_dir_path; + + assert (n.directory ()); return n.dir; } } |