From d51892e33a0fe69e743e02d9620312133a7ac61d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 21 Jan 2021 11:00:32 +0200 Subject: Use target name to derive binless library -l-name --- libbuild2/cc/pkgconfig.cxx | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'libbuild2/cc/pkgconfig.cxx') 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; -- cgit v1.1