diff options
Diffstat (limited to 'build2/scope')
-rw-r--r-- | build2/scope | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/build2/scope b/build2/scope index ad9c3a0..3649aa1 100644 --- a/build2/scope +++ b/build2/scope @@ -218,6 +218,20 @@ namespace build2 const target_type* find_target_type (name&, const string*& ext) const; + // Dynamically derive a new target type from an existing one. Return the + // reference to the target type and an indicator of whether it was + // actually created. + // + pair<reference_wrapper<const target_type>, bool> + derive_target_type (const string& name, const target_type& base); + + template <typename T> + pair<reference_wrapper<const target_type>, bool> + derive_target_type (const string& name) + { + return derive_target_type (name, T::static_type); + } + // Rules. // public: |