title: `ninja` with multiple `build.ninja` files?
body: <p>I would like to launch multiple <code>ninja</code> builds simultaneously. Each build is in its own directory and has its own <code>build.ninja</code> file.</p>
  
  <p>I could just do the following:</p>
  
  <pre><code>cd &lt;build-dir-1&gt;
  ninja &amp;
  cd &lt;build-dir-2&gt;
  ninja &amp;
  ...
  cd &lt;build-dir-last&gt;
  ninja
  </code></pre>
  
  <p>....but there are a couple of issues with this:</p>
  
  <ul>
  <li>The default number of threads used by Ninja probably isn't optimal when launching multiple independent builds simultaneously.</li>
  <li>Output will, I expect, be interleaved in a non-sensible way.</li>
  </ul>
  
  <p><strong>EDIT</strong> I could also just keep the <code>ninja</code> calls in the foreground (which is what I'm currently doing), but then there would be no easy way to estimate what the current progress of the (entire) build is.</p>
  
  <p>So, I would like to do one of the following:</p>
  
  <ol>
  <li>merge the <code>build.ninja</code> files into one big file that can perform
  both builds in one <code>ninja</code> invocation.</li>
  <li>somehow launch <code>ninja</code> with multiple target <code>build.ninja</code> scripts.</li>
  </ol>
  
  <p>It doesn't look like that second option is supported by <code>ninja</code>, but the first seems like it could be done easily enough using <code>subninja &lt;build-dir-n&gt;/build.ninja</code>. Has anyone done something like this before? Are there any hidden pitfalls? Alternatively, I could just perform the builds in sequence (i.e. the above sequence but without the <code>&amp;</code>s), but this doesn't feel like the right solution.</p>
  
  <h3>Use-case</h3>
  
  <p>I'm using <code>CMake</code>, which generates a separate <code>build.ninja</code> file for each build configuration (release and debug). I'm also targeting multiple platforms, so I have multiple compiler, and CMake must be run separately for each platform. So if I want to build release <em>and</em> debug code for <em>all</em> platforms, I need to run <code>ninja</code> multiple times.</p>