[cmake-developers] Rename Ninja generator?
Peter Collingbourne
peter at pcc.me.uk
Thu Mar 8 21:34:11 EST 2012
On Thu, Mar 08, 2012 at 05:44:09PM -0500, Bill Hoffman wrote:
> I am wondering if we want to call the Ninja generator something like:
>
> Ninja Makefiles... It is not totally accurate, but it avoids code like
> this:
>
>
> IF(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja")
>
> Also, it is more likely to work with existing cmake build files. I had
> to do the same thing with jom. Although with jom, it pretty much is a
> makefile.
>
>
> Thoughts?
Hi Bill,
I thought about this for a while and I decided that this probably
isn't a good idea for a few reasons:
1) It is inaccurate. The Ninja generator uses a fundamentally different
approach to generating build files and I think that should be
reflected in the name.
2) If we go with your suggestion, things will continue to work if what
the project does for Make happens to also be appropriate for Ninja.
But that isn't always the case -- if the project cares about
which generator is being used then it may well be doing something
specific to the Makefile generator (such as relying on the fact
that CMake builds recursive makefiles by running the build program
in a subdirectory, or using "$(MAKE)" -- you can see an example
of that in ExternalProject.cmake). In that case things would break
unless the conditional excludes Ninja:
IF(CMAKE_GENERATOR MATCHES "Makefiles" AND NOT CMAKE_GENERATOR MATCHES "Ninja")
Things like that need to be decided on a case by case basis by
the project developer and I don't see any reason to favour one
scenario over the other. All things being equal I would err on
the conservative side and say that Ninja shouldn't receive any
special treatment from projects by default -- if projects need
the Ninja generator to get the same special treatment, they can
match Ninja explicitly.
3) Less typing :) (Though one idea I had for improving the
user interface for the -G option was to allow the argument to
be matched case insensitively, and for unambiguous prefixes to
be expanded. So for example you could say -G nmake which would
be disambiguated to "NMake Makefiles", but -G n would return an
error since it matches both Ninja and NMake).
Thanks,
--
Peter
More information about the cmake-developers
mailing list