From a84ff43b183181e0a12c6d5e31c1f366d39ce2fe Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 31 Jul 2017 18:42:47 +0200 Subject: Experimental (and probably broken) pkg-config generation support --- build2/target.hxx | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'build2/target.hxx') diff --git a/build2/target.hxx b/build2/target.hxx index 7cc7f95..3af533f 100644 --- a/build2/target.hxx +++ b/build2/target.hxx @@ -250,7 +250,8 @@ namespace build2 // - Member variable lookup skips the ad hoc group (since the group is // the first member, this is normally what we want). // - // Use add_adhoc_member() from algorithms to add an ad hoc member. + // Use add_adhoc_member(), find_adhoc_member() from algorithms to manage + // ad hoc members. // const_ptr member = nullptr; @@ -1686,8 +1687,8 @@ namespace build2 virtual const target_type& dynamic_type () const {return static_type;} }; - // Common implementation of the target factory, extension, and - // search functions. + // Common implementation of the target factory, extension, and search + // functions. // template pair> @@ -1700,6 +1701,26 @@ namespace build2 return make_pair (new T (move (d), move (o), move (n)), move (e)); } + template + static pair> + file_factory (const target_type& tt, + dir_path d, + dir_path o, + string n, + optional e) + { + // A generic file target type doesn't imply any extension while a very + // specific one (say man1) may have a fixed extension. So if one wasn't + // specified and this is not a dynamically derived target type, then set + // it to fixed ext rather than unspecified. For file{} itself we make it + // empty which means we treat file{foo} as file{foo.}. + // + if (!e && ext != nullptr && tt.factory == &file_factory) + e = string (ext); + + return make_pair (new T (move (d), move (o), move (n)), move (e)); + } + // Return fixed target extension. // template -- cgit v1.1