[cmake] Use CMAKE_GENERATOR to determine if Ninja is used
The name of the make program does not necessarily match "ninja",
especially if an alternative implementation like samurai is used.
Using CMAKE_GENERATOR is a more robust detection method, and is
already used elsewhere in this file.
Differential revision: https://reviews.llvm.org/D77091