I did some research to find out why builds with Ninja sometimes miss
dependencies, thus producing build failures unless the failing
repository is recompiled from scratch. It was a bug (or somewhat
justifiable behavior difference between Make and Ninja if you like) in
CMake that has been fixed:
So if you compile with Ninja, you should get CMake 3.6.0+, or switch
back to Make until you get 3.6.0+.
Maybe packagers want to backport the fix. I see that Ubuntu Yakkety is
going to ship CMake 3.5.2.