aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/cc')
-rw-r--r--libbuild2/cc/common.cxx27
1 files changed, 21 insertions, 6 deletions
diff --git a/libbuild2/cc/common.cxx b/libbuild2/cc/common.cxx
index 587ae08..d24eb02 100644
--- a/libbuild2/cc/common.cxx
+++ b/libbuild2/cc/common.cxx
@@ -528,6 +528,8 @@ namespace build2
assert (p.scope != nullptr);
+ context& ctx (p.scope->ctx);
+
// @@ This is hairy enough to warrant a separate implementation for
// Windows.
@@ -800,11 +802,25 @@ namespace build2
//
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).
+ const scope& rs (*p.scope->root_scope ());
+
+ // Check if import.build2 is set to NULL to disable relying on the
+ // built-in path. We use this in our tests to make sure we are
+ // importing and testing the build system being built and not the
+ // one doing the building.
+ //
+ // Note that for the installed case this value is undefined by
+ // default.
//
- usrd->insert (usrd->begin (), build_install_lib);
+ lookup l (rs[ctx.var_import_build2]);
+ if (!(l.defined () && l->null))
+ {
+ // 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);
+ }
}
}
@@ -840,8 +856,7 @@ namespace build2
// Enter (or find) the lib{} target group.
//
lib* lt;
- insert_library (
- p.scope->ctx, lt, name, *pd, l ? p.tk.ext : nullopt, exist, trace);
+ insert_library (ctx, lt, name, *pd, l ? p.tk.ext : nullopt, exist, trace);
// Result.
//