diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-31 18:42:47 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-31 18:44:07 +0200 |
commit | a84ff43b183181e0a12c6d5e31c1f366d39ce2fe (patch) | |
tree | 3dce54b64fd8e9917ed034a3e2c9e20f057eece4 /build2/target.hxx | |
parent | 89f5bc3b423a1269a60ccca05174226c8de40357 (diff) |
Experimental (and probably broken) pkg-config generation support
Diffstat (limited to 'build2/target.hxx')
-rw-r--r-- | build2/target.hxx | 27 |
1 files changed, 24 insertions, 3 deletions
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<target> 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 <typename T> pair<target*, optional<string>> @@ -1700,6 +1701,26 @@ namespace build2 return make_pair (new T (move (d), move (o), move (n)), move (e)); } + template <typename T, const char* ext> + static pair<target*, optional<string>> + file_factory (const target_type& tt, + dir_path d, + dir_path o, + string n, + optional<string> 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<T, ext>) + e = string (ext); + + return make_pair (new T (move (d), move (o), move (n)), move (e)); + } + // Return fixed target extension. // template <const char* ext> |