[cmake-developers] Using CMake generated ninja file as a subninja file

Nicolas Desprès nicolas.despres at gmail.com
Wed Jan 6 13:26:11 EST 2016


On Wed, Jan 6, 2016 at 6:25 PM, Ben Boeckel <ben.boeckel at kitware.com> wrote:

> On Wed, Jan 06, 2016 at 11:14:32 +0100, Nicolas Desprès wrote:
> > To enable this type of generation, the "top/" directory must be passed to
> > CMake somehow. An environment variable or a CMake variable called
> > CMAKE_NINJA_TOP_BUILD_DIR would do the trick.
>
> I think CMAKE_NINJA_OUTPUT_PATH_PREFIX would work fine (passed as a -D
> on the command line).
>

Is that variable already available or a name suggestion? I cannot find any
reference to it neither in the source nor in the documentation.


>
> Note that the ninja file CMake generates is then invalid except as a
> subninja file (since the build rules paths won't line up from its
> directory). I don't know how acceptable that would be. Maybe a separate
> Subninja generator which uses it and writes out a build.subninja file
> instead?
>
This is acceptable for me since I have a custom generator that would write
the top build.ninja containing "subninja sub/build.ninja". The end-user is
supposed to run ninja from the top directory not from the top/sub/
directory.

-- 
Nicolas Desprès
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160106/9c29e4e3/attachment.html>


More information about the cmake-developers mailing list