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/algorithm.hxx | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'build2/algorithm.hxx') diff --git a/build2/algorithm.hxx b/build2/algorithm.hxx index 2006e2a..931b396 100644 --- a/build2/algorithm.hxx +++ b/build2/algorithm.hxx @@ -136,14 +136,37 @@ namespace build2 target_lock lock (action, const target&); - // Add an ad hoc member. If the suffix is specified, it is added (as an - // extension) to the member's target name. Return the locked member target. + // Add an ad hoc member to the end of the chain assuming that an already + // existing member of this target type is the same. + // + // If the suffix is specified, it is added (as an extension) to the member's + // target name. Return the locked member target. // target_lock add_adhoc_member (action, target&, const target_type&, const char* suffix = nullptr); + template + inline target_lock + add_adhoc_member (action a, target& t, const char* s = nullptr) + { + return add_adhoc_member (a, t, T::static_type, s); + } + + // Find an ad hoc member of the specified target type returning NULL if not + // found. + // + const target* + find_adhoc_member (const target&, const target_type&); + + template + inline const T* + find_adhoc_member (const target& t) + { + return static_cast (find_adhoc_member (t, T::static_type)); + } + // Match and apply a rule to the action/target with ambiguity detection. // Increment the target's dependents count, which means that you should call // this function with the intent to also call execute(). Return the target -- cgit v1.1