// file : build2/target.txx -*- C++ -*- // copyright : Copyright (c) 2014-2016 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file #include #include // extension_pool #include #include namespace build2 { template const string& target_extension_fix (const target_key&, scope&) { return extension_pool.find (ext); } template const string& target_extension_var (const target_key& tk, scope& s) { // Include target type/pattern-specific variables. // if (auto l = s.lookup (tk, var)) { // Help the user here and strip leading '.' from the extension. // const string& e (as (*l)); return extension_pool.find ( !e.empty () && e.front () == '.' ? string (e, 1) : e); } if (def != nullptr) return extension_pool.find (def); // Similar code to target_extension_fail(). // { diag_record dr; dr << error << "no default extension in variable '" << var << "'" << info << "required to derive file name for "; if (tk.dir->absolute ()) dr << "target " << tk; else dr << "prerequisite " << prerequisite_key {nullptr, tk, &s}; dr << info << "perhaps you forgot to add " << tk.type->name << "{*}: " << var << " = ..."; } throw failed (); } }