From 0d275db1433dec9bc7b4fcf5fcd28b42da3b6166 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 6 Sep 2018 19:20:01 +0200 Subject: Fix issues with interaction between binless logic and Windows DLLs --- build2/cc/pkgconfig.cxx | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'build2/cc/pkgconfig.cxx') diff --git a/build2/cc/pkgconfig.cxx b/build2/cc/pkgconfig.cxx index b0634fb..cbc4c50 100644 --- a/build2/cc/pkgconfig.cxx +++ b/build2/cc/pkgconfig.cxx @@ -549,30 +549,38 @@ namespace build2 // struct data { - pair r; + path a; + path s; bool common; - } d {{}, common}; + } d {path (), path (), common}; auto check = [&d, &search_dir] (dir_path&& p) -> bool { // First look for static/shared-specific files. // - d.r.first = search_dir (p, ".static"); - d.r.second = search_dir (p, ".shared"); + d.a = search_dir (p, ".static"); + d.s = search_dir (p, ".shared"); - if (!d.r.first.empty () || !d.r.second.empty ()) + if (!d.a.empty () || !d.s.empty ()) return false; // Then the common. // if (d.common) - d.r.first = d.r.second = search_dir (p, string ()); + d.a = d.s = search_dir (p, ""); - return d.r.first.empty (); + return d.a.empty (); }; - pkgconfig_search (libd, check); - return d.r; + pair r; + + if (pkgconfig_search (libd, check)) + { + r.first = move (d.a); + r.second = move (d.s); + } + + return r; }; bool common:: @@ -1084,7 +1092,14 @@ namespace build2 // the saving logic). // pkgconf& ipc (sp.empty () ? apc : spc); // Interface package info. - bool ibl ((sp.empty () ? at->path () : st->path ()).empty ()); // Binless. + bool ibl (sp.empty () // Binless. + ? at->path ().empty () + // + // On Windows the shared library could be a DLL with an empty + // path (unknown location) and an ad hoc member that is the + // import library. See search_library() for details. + // + : st->path ().empty () && st->member != nullptr); bool pa (at != nullptr && !ap.empty ()); if (pa || sp.empty ()) -- cgit v1.1