Enable support for Ninja build generator

Use the Ninja build generator if '--enable-ninja' is passed on the
command line to ./configure (or of course if -GNinja is passed
directly to CMake).