aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/cc/init.cxx11
-rw-r--r--libbuild2/cc/pkgconfig.cxx24
2 files changed, 30 insertions, 5 deletions
diff --git a/libbuild2/cc/init.cxx b/libbuild2/cc/init.cxx
index 75b32bb..062e750 100644
--- a/libbuild2/cc/init.cxx
+++ b/libbuild2/cc/init.cxx
@@ -139,13 +139,14 @@ namespace build2
// values are "binless" (library is binless) and "recursively-binless"
// (library and all its prerequisite libraries are binless). Note that
// another indication of a binless library is an empty path, which could
- // easier/faster to check. Note also that there should be no whitespaces
- // of any kind and <lang> is always first.
+ // be easier/faster to check. Note also that there should be no
+ // whitespaces of any kind and <lang> is always first.
//
// This value should be set on the library target as a rule-specific
- // variable by the matching rule. Currently <lang> is used to decide
- // which *.libs to use during static linking. The "cc" language is used
- // in the import installed logic.
+ // variable by the matching rule. It is also saved in the generated
+ // pkg-config files. Currently <lang> is used to decide which *.libs to
+ // use during static linking. The "cc" language is used in the import
+ // installed logic.
//
// Note that this variable cannot be set via the target type/pattern-
// specific mechanism (see process_libraries()).
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).
//