aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-10-13 15:13:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-10-13 15:13:44 +0200
commit8b35f7a1936b15e46e2f7a40f00f3ade5a60dccc (patch)
tree0cbd4e97b577784602a6cb16433117ffcbfbb352
parent9e15fc723325857027daacac34dba1245e805232 (diff)
Fix bug in pkg-config metadata extraction logic
-rw-r--r--libbuild2/cc/pkgconfig.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/libbuild2/cc/pkgconfig.cxx b/libbuild2/cc/pkgconfig.cxx
index 6023b45..7f667f0 100644
--- a/libbuild2/cc/pkgconfig.cxx
+++ b/libbuild2/cc/pkgconfig.cxx
@@ -802,14 +802,11 @@ namespace build2
context& ctx (t.ctx);
- // These should be public (qualified) variables so go straight for
- // the public variable pool.
- //
- auto& vp (ctx.var_pool.rw ()); // Load phase.
-
optional<uint64_t> ver;
optional<string> pfx;
+ variable_pool* vp (nullptr); // Resolve lazily.
+
string s;
for (size_t b (0), e (0); !(s = next (md, b, e)).empty (); )
{
@@ -870,7 +867,13 @@ namespace build2
: name (move (s)));
}
- const variable& var (vp.insert (move (vn)));
+ // These should be public (qualified) variables so go straight for
+ // the public variable pool.
+ //
+ if (vp == nullptr)
+ vp = &ctx.var_pool.rw (); // Load phase if user==true.
+
+ const variable& var (vp->insert (move (vn)));
value& v (t.assign (var));
v.assign (move (ns), &var);