aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/file.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/file.cxx')
-rw-r--r--libbuild2/file.cxx33
1 files changed, 28 insertions, 5 deletions
diff --git a/libbuild2/file.cxx b/libbuild2/file.cxx
index 1c6bb1d..f0215df 100644
--- a/libbuild2/file.cxx
+++ b/libbuild2/file.cxx
@@ -1296,6 +1296,13 @@ namespace build2
{
string n ("config.import." + proj.variable ());
+ auto skip = [&target, &proj, &trace] ()
+ {
+ target.proj = move (proj);
+ l5 ([&]{trace << "skipping " << target;});
+ return make_pair (move (target), dir_path ());
+ };
+
// config.import.<proj>
//
{
@@ -1318,11 +1325,7 @@ namespace build2
// to use system-installed).
//
if (out_root.empty ())
- {
- target.proj = move (proj);
- l5 ([&]{trace << "skipping " << target;});
- return make_pair (move (target), dir_path ());
- }
+ return skip ();
break;
}
@@ -1383,6 +1386,26 @@ namespace build2
}
}
+ // import.build2
+ //
+ if (proj == "build2")
+ {
+ // Note that this variable can be 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.
+ //
+ if (auto l = iroot[ctx.var_import_build2])
+ {
+ out_root = cast<dir_path> (l);
+
+ if (out_root.empty ())
+ return skip ();
+
+ break;
+ }
+ }
+
// Otherwise search subprojects, starting with our root and then trying
// outer roots for as long as we are inside an amalgamation.
//