aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-08-06 12:21:27 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-08-06 12:22:27 +0200
commit306ab0a69a6ea105f5820eb9a7113757f5e47655 (patch)
treedb88966250a8f195a759d4b6da4d2d1e76ee140c
parent1511d2d85e1a2142461af1b4cce4e47350fec7d0 (diff)
Create output directory for module sidebuilds
The fsdir{} injection doesn't do it if out == src.
-rw-r--r--build2/cc/compile.cxx17
1 files changed, 13 insertions, 4 deletions
diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx
index 5f48492..dad53ff 100644
--- a/build2/cc/compile.cxx
+++ b/build2/cc/compile.cxx
@@ -3570,13 +3570,22 @@ namespace build2
//
if (const target* bt = targets.find (
*tt,
- move (md),
+ md,
dir_path (), // Always in the out tree.
- move (mf),
+ mf,
nullopt, // Use default extension.
trace))
return *bt;
+ // Make sure the output directory exists. This is not strictly necessary
+ // if out != src since inject_fsdir() will take case of it. For out ==
+ // src we initially tried to add an explicit fsdir{} preprequisite but
+ // that didn't work out since this is a nested directory. So now we keep
+ // it simple and just create it. The proper way to handle this as well
+ // as cleanup is probably at the cxx module level, which is @@ TODO.
+ //
+ mkdir_p (md, 3);
+
prerequisites ps;
ps.push_back (prerequisite (mt));
@@ -3609,8 +3618,8 @@ namespace build2
trace));
const target& bt (p.first);
- // Note that this racy and someone might have created this target
- // while we were preparing the prerequisite list.
+ // Note that this racy and someone might have created this target while
+ // we were preparing the prerequisite list.
//
if (p.second.owns_lock ())
bt.prerequisites (move (ps));