From 7eb5fa7d01a5ee352b65b6f08ec893abcf016096 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 29 Jun 2022 08:11:23 +0200 Subject: Save cc.type in pkg-config files --- libbuild2/cc/pkgconfig.cxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'libbuild2/cc/pkgconfig.cxx') diff --git a/libbuild2/cc/pkgconfig.cxx b/libbuild2/cc/pkgconfig.cxx index 652d410..de7cc73 100644 --- a/libbuild2/cc/pkgconfig.cxx +++ b/libbuild2/cc/pkgconfig.cxx @@ -1607,6 +1607,10 @@ namespace build2 if (ps) parse_cflags (*st, spc, false); + // @@ TODO: we can now load cc.type if there is metadata (but need to + // return this rather than set, see search_library() for + // details). + // Load the bin.whole flag (whole archive). // if (at != nullptr && (pa ? apc_meta : spc_meta)) @@ -2271,6 +2275,26 @@ namespace build2 << "build2.metadata = 1" << endl; } + // Save cc.type (see init() for the format documentation). + // + // Note that this value is set by link_rule and therefore should + // be there. + // + { + const string& t ( + cast ( + l.state[a].lookup_original ( + c_type, true /* target_only */).first)); + + // If common, then only save the language (the rest could be + // static/shared-specific; strictly speaking even the language could + // be, but that seems far fetched). + // + os << endl + << "cc.type = " << (common ? string (t, 0, t.find (',')) : t) + << endl; + } + // Save the bin.whole (whole archive) flag (see the link rule for // details on the lookup semantics). // -- cgit v1.1