From 1d925696ac7eb8d7adb4d70b3f5afb010d745931 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 11 Jan 2024 11:02:16 +0200 Subject: Add ability to alias target type from another project The syntax is: define = / --- libbuild2/target-type.hxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libbuild2/target-type.hxx') diff --git a/libbuild2/target-type.hxx b/libbuild2/target-type.hxx index c0a5571..fcf867a 100644 --- a/libbuild2/target-type.hxx +++ b/libbuild2/target-type.hxx @@ -201,18 +201,18 @@ namespace build2 return type_map_.empty (); } - const target_type& + pair, bool> insert (const target_type& tt) { - type_map_.emplace (tt.name, target_type_ref (tt)); - return tt; + auto r (type_map_.emplace (tt.name, target_type_ref (tt))); + return {r.second ? tt : r.first->second.get (), r.second}; } template const target_type& insert () { - return insert (T::static_type); + return insert (T::static_type).first; } pair, bool> -- cgit v1.1