[cmake-developers] Ninja Generator and CMAKE_VERBOSE_MAKEFILE

Brad King brad.king at kitware.com
Wed Feb 25 14:30:42 EST 2015


On 02/25/2015 12:38 PM, Gregor Jasny wrote:
> Ninja has no equivalent option.
> 
> As a work-around would it be possible that cmake --build examines the
> cache, detects CMAKE_VERBOSE_MAKEFILE=ON and adds a -v to the Ninja
> invocation?

If you know that the build tree was generated with the Ninja generator
then you can do

 cmake --build . -- -v

to pass the flag to ninja.  Of course if you knew that then you could
always run "ninja -v" instead of using "cmake --build" ;)

> As a work-around would it be possible that cmake --build examines the
> cache, detects CMAKE_VERBOSE_MAKEFILE=ON and adds a -v to the Ninja
> invocation?
> 
> If you think that this is a reasonable approach could you please give me
> some pointers where to insert the necessary code?

Yes, I think that is reasonable if the above is not sufficient.

The cmake::Build method in Source/cmake.cxx loads the cache already
to get CMAKE_GENERATOR and create the generator, which is then used
to compute the generator-specific build command.  You could extract
CMAKE_VERBOSE_MAKEFILE there too and extend the signatures of the
methods as necessary to thread the value through.

-Brad



More information about the cmake-developers mailing list