aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/cc/compile.cxx15
-rw-r--r--build2/target-type2
2 files changed, 11 insertions, 6 deletions
diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx
index b5bcc50..92ddf3b 100644
--- a/build2/cc/compile.cxx
+++ b/build2/cc/compile.cxx
@@ -283,12 +283,17 @@ namespace build2
// We will just have to try all of the possible ones, in the "most
// likely to match" order.
//
- const variable& var (var_pool["extension"]);
-
- auto test = [&s, &n, &e, &var] (const target_type& tt) -> bool
+ auto test = [&s, &n, &e] (const target_type& tt) -> bool
{
- if (auto l = s.find (var, tt, n))
- if (cast<string> (l) == e)
+ // Call the extension derivation function. Here we know that it will
+ // only use the target type and name from the target key so we can
+ // pass bogus values for the rest.
+ //
+ const string* dummy (nullptr);
+ target_key tk {&tt, nullptr, nullptr, &n, dummy};
+
+ if (const string* de = tt.extension (tk, s))
+ if (*de == e)
return true;
return false;
diff --git a/build2/target-type b/build2/target-type
index 6140ab1..378fd7c 100644
--- a/build2/target-type
+++ b/build2/target-type
@@ -31,7 +31,7 @@ namespace build2
// respectively. If the extension function returns NULL, then that means the
// default extension for this target could not be derived.
//
- // The extension function is used in two places: search_existing_file()
+ // The extension is primarily used in two places: search_existing_file()
// (called for a prerequisite) and in target::derive_path() (called for a
// target); see their implementations for details.
//