On 04/07/2018 01:30 AM, Niels Thykier wrote:
Thanks. :)
I am glad it worked. :)
My VTK package is currently building with cmake+ninja in sid, and
leaving cmake+makefile in the dust. I love it. Thank you so much!
Mmm, the reason why make does not fail is that we have a crude (but
functional) way to tell if a makefile target exists. But we do not have
that for ninja and honestly, I have no idea how we would make it either.
If you have an idea, I would be happy to look at implementing it.
There are a couple options I can think of:
1. $ ninja -n test - this does a dry run. If the "test" target exists
then it succeeds (regardless of whether or not the real target would
have succeeded), otherwise it fails. Simple and elegant.
2. You could also manually parse build.ninja and its included files.
Admittedly not as simple, but Ninja is intended to be machine-readable
and fast, so it might not be as bad as parsing a Makefile.
2a. Alternatively, start by simply grepping build.ninja for "^build[
\t]+test:" or something similar. It might not include every corner case,
but it would be a good start (more than we have right now), and I don't
think it would yield any false positives. CMake takes a similar approach
in trying to find #defines in header files - see
https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/FindBoost.cmake#L1291
for an example.
Kyle