[CMake] improve the CMake language?

Brandon Van Every bvanevery at gmail.com
Thu Nov 1 20:20:52 EDT 2007


Recently I've been doing a non-trivial amount of programming in CMake
script.  When I started my current project I thought it would be a
quick throwaway, but it has ballooned into a substantial body of code
with a call structure about 3 routines deep.  I've started to feel the
pinch of MACRO variables shadowing each other.  I find myself writing
long variable names out of paranoia that they'll collide.  I've had
some bugs due to that, so it's not groundless paranoia.  It's making
the code a lot less readable, not to mention being more tedious to
type.  I've made note of escape problems when passing literal strings
to MACROs, as have others.  I've discovered regex bugs.  I've also had
plenty of regex misunderstandings that were not bugs, because there's
no documentation for all the behavioral corner cases.

Is it worth trying to address these problems and make CMake a better
scripting language?  Currently I'd have to tell people, "you can do
small things with CMake script, but if you do bigger things, it'll
waste your time."  I tried to do it anyways because I thought maybe it
didn't have to be that way.  Maybe I really don't have to install
Python or Ruby or Perl or whatever, maybe the build can be completely
self-contained in CMake.  But it looks like it would be substantial
work to fix the lexical scoping or add Perl Compatible Regular
Expression support.  Maybe lexical scoping can't be fixed at all?  And
maybe PCRE is hitting a fly with a sledgehammer, way more regex power
than most people are going to need.

My concern is that if the status quo is maintained, CMake script will
always be ugly to program with.  This will put it at a disadvantage
compared to build systems written in Python, Ruby, or Perl.  I'm not
just talking about SCons and so forth.  I'm talking about a shop
deciding, hey, screw this off-the-shelf stuff, we'll write our own
custom build system in our favorite scripting language.  It happens in
the game industry all the time.

Your thoughts?


Cheers,
Brandon Van Every


More information about the CMake mailing list