diff options
Diffstat (limited to 'libbuild2/target.cxx')
-rw-r--r-- | libbuild2/target.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libbuild2/target.cxx b/libbuild2/target.cxx index dbca6cd..22f5e66 100644 --- a/libbuild2/target.cxx +++ b/libbuild2/target.cxx @@ -4,6 +4,8 @@ #include <libbuild2/target.hxx> +#include <cstring> // strcmp() + #include <libbuild2/file.hxx> #include <libbuild2/scope.hxx> #include <libbuild2/search.hxx> @@ -19,6 +21,19 @@ namespace build2 // target_type // bool target_type:: + is_a (const char* n) const + { + if (strcmp (name, n) == 0) + return true; + + for (const target_type* b (base); b != nullptr; b = b->base) + if (strcmp (b->name, n) == 0) + return true; + + return false; + } + + bool target_type:: is_a_base (const target_type& tt) const { for (const target_type* b (base); b != nullptr; b = b->base) |