aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-01-21 11:00:32 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-01-21 11:00:32 +0200
commitd51892e33a0fe69e743e02d9620312133a7ac61d (patch)
tree3901249c087f5e2bca40e8c6783f86c795c2b092 /libbuild2
parentbbf3c05a08279cfa08aacd5ff721e58c9dab58f4 (diff)
Use target name to derive binless library -l-name
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/cc/common.cxx4
-rw-r--r--libbuild2/cc/pkgconfig.cxx24
2 files changed, 22 insertions, 6 deletions
diff --git a/libbuild2/cc/common.cxx b/libbuild2/cc/common.cxx
index 9cac1b0..1bbdf14 100644
--- a/libbuild2/cc/common.cxx
+++ b/libbuild2/cc/common.cxx
@@ -950,6 +950,10 @@ namespace build2
// idea is that in .pc files that we generate, we copy those macros
// (or custom ones) from *.export.poptions.
//
+ // @@ Should we add .pc files as ad hoc members so pkconfig_save() can
+ // use their names when deriving -l-names (this would be expecially
+ // helpful for binless libraries to get hold of prefix/suffix, etc).
+ //
if (pc.first.empty () && pc.second.empty ())
{
if (!pkgconfig_load (act, *p.scope,
diff --git a/libbuild2/cc/pkgconfig.cxx b/libbuild2/cc/pkgconfig.cxx
index 75c7227..6a1b3c8 100644
--- a/libbuild2/cc/pkgconfig.cxx
+++ b/libbuild2/cc/pkgconfig.cxx
@@ -1479,13 +1479,25 @@ namespace build2
}
else
{
- // Derive -l-name from the file name in a fuzzy, platform-specific
- // manner.
- //
- n = l.path ().leaf ().base ().string ();
+ const path& p (l.path ());
- if (cclass != compiler_class::msvc)
- strip_lib ();
+ if (p.empty ()) // Binless.
+ {
+ // For a binless library the target name is all it can possibly
+ // be.
+ //
+ n = l.name;
+ }
+ else
+ {
+ // Derive -l-name from the file name in a fuzzy, platform-
+ // specific manner.
+ //
+ n = p.leaf ().base ().string ();
+
+ if (cclass != compiler_class::msvc)
+ strip_lib ();
+ }
}
os << " -l" << n;