aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/common.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-01-31 15:34:13 +0200
committerKaren Arutyunov <karen@codesynthesis.com>2020-01-31 18:08:57 +0300
commita9cadecf15385f93ad3eb6b6b0bdeaafd741b0a7 (patch)
tree3212b7b09d719ea8bc2688756e391ebd87dc3bc6 /libbuild2/cc/common.cxx
parent50ae0c791cf94199c4cdc1674d8562b1c00046ea (diff)
Propagate installed library out (tag) when converting to name
Diffstat (limited to 'libbuild2/cc/common.cxx')
-rw-r--r--libbuild2/cc/common.cxx26
1 files changed, 18 insertions, 8 deletions
diff --git a/libbuild2/cc/common.cxx b/libbuild2/cc/common.cxx
index e1a2385..1af64c8 100644
--- a/libbuild2/cc/common.cxx
+++ b/libbuild2/cc/common.cxx
@@ -299,8 +299,10 @@ namespace build2
if (ns == nullptr || ns->empty ())
return;
- for (const name& n: *ns)
+ for (auto i (ns->begin ()), e (ns->end ()); i != e; ++i)
{
+ const name& n (*i);
+
if (n.simple ())
{
// This is something like -lpthread or shell32.lib so should be
@@ -318,7 +320,13 @@ namespace build2
if (sysd == nullptr) find_sysd ();
if (!li) find_linfo ();
- const file& t (resolve_library (a, bs, n, *li, *sysd, usrd));
+ const file& t (
+ resolve_library (a,
+ bs,
+ n,
+ (n.pair ? (++i)->dir : dir_path ()),
+ *li,
+ *sysd, usrd));
if (proc_lib)
{
@@ -433,30 +441,32 @@ namespace build2
const file& common::
resolve_library (action a,
const scope& s,
- name n,
+ const name& cn,
+ const dir_path& out,
linfo li,
const dir_paths& sysd,
optional<dir_paths>& usrd) const
{
- if (n.type != "lib" && n.type != "liba" && n.type != "libs")
- fail << "target name " << n << " is not a library";
+ if (cn.type != "lib" && cn.type != "liba" && cn.type != "libs")
+ fail << "target name " << cn << " is not a library";
const target* xt (nullptr);
- if (!n.qualified ())
+ if (!cn.qualified ())
{
// Search for an existing target with this name "as if" it was a
// prerequisite.
//
- xt = search_existing (n, s);
+ xt = search_existing (cn, s, out);
if (xt == nullptr)
- fail << "unable to find library " << n;
+ fail << "unable to find library " << cn;
}
else
{
// This is import.
//
+ name n (cn);
auto rp (s.find_target_type (n, location ())); // Note: changes name.
const target_type* tt (rp.first);
optional<string>& ext (rp.second);