aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/cc')
-rw-r--r--libbuild2/cc/common.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/libbuild2/cc/common.cxx b/libbuild2/cc/common.cxx
index f14f973..587ae08 100644
--- a/libbuild2/cc/common.cxx
+++ b/libbuild2/cc/common.cxx
@@ -786,13 +786,28 @@ namespace build2
return a != nullptr || s != nullptr;
};
- // First try user directories (i.e., -L).
+ // First try user directories (i.e., -L or /LIBPATH).
//
bool sys (false);
if (!usrd)
+ {
usrd = extract_library_dirs (*p.scope);
+ // Handle automatic importing of installed build2 libraries. This is a
+ // mirror side of the uninstalled case that is handled via the special
+ // import.build2 value in import_search().
+ //
+ if (build_installed && p.proj && *p.proj == "build2")
+ {
+ // Note that we prepend it to other user directories instead of
+ // making it the only one to allow things to be overriden (e.g., if
+ // build2 was moved or some such).
+ //
+ usrd->insert (usrd->begin (), build_install_lib);
+ }
+ }
+
const dir_path* pd (nullptr);
for (const dir_path& d: *usrd)
{