[cmake-developers] new ninja rebuild too much issue

Nicolas Desprès nicolas.despres at gmail.com
Wed Mar 14 13:42:53 EDT 2012


On Wed, Mar 14, 2012 at 6:10 PM, Peter Collingbourne <peter at pcc.me.uk> wrote:
> On Wed, Mar 14, 2012 at 10:45:39AM -0400, Bill Hoffman wrote:
>> On 3/14/2012 7:34 AM, Nicolas Desprčs wrote:
>>> Nope if you like in the generated build.ninja "build.ninja" appears
>>> only once as an output using the RERUN_CMAKE rule.
>>>
>>> I rather think it is a bug in ninja of the restat implementation.
>> What is the way to debug this?  Can you get ninja to tell you why it is
>> choosing to do a build of a file?  This is quite reproducible.
>
> Most likely, this is due to the compile command line changing between
> runs.  If any command line changes, Ninja will need to re-run that
> command.  In particular, toggling CMAKE_ENABLE_NINJA would affect
> whether CMAKE_USE_NINJA is defined on the command line for anything
> under Source.  Ninja stores previously run commands in .ninja_log so
> you can examine that to verify that the command line is changing.
>
> We can probably reduce the amount of recompilation required by only
> defining CMAKE_ENABLE_NINJA for cmake.cxx (the only source file that
> uses it).
>

$ ../_build/bin/cmake -DCMAKE_ENABLE_NINJA=OFF .
$ ../_build/bin/cmake -DCMAKE_ENABLE_NINJA=ON .
$ ninja
ninja: no work to do.
$ ../_build/bin/cmake -DCMAKE_ENABLE_NINJA=OFF .
$ ninja
[...compile 200 outputs...]

I just check the .ninja_log and Peter is right.

Cheers,

-- 
Nicolas Desprès



More information about the cmake-developers mailing list