[cmake-developers] ninja enforces explicit dependencies before order-only

Brad King brad.king at kitware.com
Tue Apr 2 12:52:45 EDT 2013


On 04/02/2013 11:35 AM, Matthew Woehlke wrote:
> Why are the rules set up like this and not such that b.txt depends on A?

A and B are separate CMake logical targets.  There is no concept
in CMake of a file depending on a logical target.  There is no
way to express that in the generated VS or Makefile build systems.

> I'm not convinced this is a bug

It works in all generators except Ninja.  Therefore it is at least a
bug in CMake's Ninja generator by not finding a way to implement the
desired behavior with its native build system.  If it is not possible
to implement the behavior in Ninja then that is a missing feature.

Think of each CMake logical target as its own isolated make process.
Evaluation of a dependent target does not even start until after
its dependencies have finished.  In the example I posted target
"B" has no rule to build file "a.txt" so it assumes that the file
always exists as if it were a source file.  The assumption is valid
because target B should not be evaluated until target A is done.  We
need a way to implement this with Ninja.

-Brad



More information about the cmake-developers mailing list