aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/pkgconfig.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-06-29 08:11:23 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-06-29 08:11:23 +0200
commit7eb5fa7d01a5ee352b65b6f08ec893abcf016096 (patch)
tree15a977eb649c4ce745d165bb527a3bb860bbf52c /libbuild2/cc/pkgconfig.cxx
parenta2204bee4723a7a5036d2b3b888984976c5a93e7 (diff)
Save cc.type in pkg-config files
Diffstat (limited to 'libbuild2/cc/pkgconfig.cxx')
-rw-r--r--libbuild2/cc/pkgconfig.cxx24
1 files changed, 24 insertions, 0 deletions
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<string> (
+ 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).
//