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

Ben Boeckel ben.boeckel at kitware.com
Wed Jan 6 12:25:04 EST 2016


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).

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?

--Ben


More information about the cmake-developers mailing list