From 421d0a4d1a7786e90407072b378cc060d325907d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 23 Aug 2019 09:46:11 +0200 Subject: Variables --- build2/cc/pkgconfig.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'build2/cc') diff --git a/build2/cc/pkgconfig.cxx b/build2/cc/pkgconfig.cxx index 13cc752..038ecc6 100644 --- a/build2/cc/pkgconfig.cxx +++ b/build2/cc/pkgconfig.cxx @@ -1228,6 +1228,8 @@ namespace build2 { tracer trace (x, "pkgconfig_save"); + context& ctx (l.ctx); + const scope& bs (l.base_scope ()); const scope& rs (*bs.root_scope ()); @@ -1256,9 +1258,12 @@ namespace build2 ofdstream os (p); { - const project_name& n (cast (rs.vars[var_project])); + const project_name& n (project (rs)); + + if (n.empty ()) + fail << "no project name in " << rs; - lookup vl (rs.vars[var_version]); + lookup vl (rs.vars[ctx.var_version]); if (!vl) fail << "no version variable in project " << n << info << "while generating " << p; @@ -1271,12 +1276,12 @@ namespace build2 // This one is required so make something up if unspecified. // os << "Description: "; - if (const string* s = cast_null (rs[var_project_summary])) + if (const string* s = cast_null (rs[ctx.var_project_summary])) os << *s << endl; else os << n << ' ' << v << endl; - if (const string* u = cast_null (rs[var_project_url])) + if (const string* u = cast_null (rs[ctx.var_project_url])) os << "URL: " << *u << endl; } -- cgit v1.1