aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/common.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-11-05 13:16:21 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-11-05 13:16:21 +0200
commit55ddc71fd801e06115ad6e33098b0eed2517daab (patch)
treec68892733b899e39c2bdc49b0ffa73282c1644d4 /libbuild2/cc/common.cxx
parent4fe1c3c083acecf7eabe46b67cb540e8390f3122 (diff)
Add support for automatic importing of libbuild2 of installed case
Diffstat (limited to 'libbuild2/cc/common.cxx')
-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)
{