[CMake] Lua in a nutshell

Ken Martin ken.martin at kitware.com
Tue Mar 4 10:07:11 EST 2008


> 2.Closing statements need and empty () [at least they don't need to
> duplicate the expressions any more].

Technically I believe this is possible. It has been asked for in the past.
Just a change to the yacc IIRC. I tend to not mind () personally.

> 7.It has no functions (implemented in the script itself I meant) [macros
> are
> not the same]

2.6 has functions

> 12.It has no scope.

Well directories have scope and always have, now functions do as well. There
is no midstream push/pop scope ala "{" "}" but you can just make a function.
There is also some object scope supported through the use of properties on
targets/source files/directories/tests/etc. But in general there has been a
bad habit of creating a lot of global variables.

> 16.Least but not least: the language is extensible but not in the user
> side.
> That is, I cannot *plugin* (entirely at the user side) my own "internal"
> functions even though the underlying system is quite extensible.

You can define your own commands and even override the default commands from
the script level. 

You can also use the C plugin API to dynamically compile and load a run time
plugin. We discourage this as it is more prone to errors (user running a
32bit CMake but building a 64 bit executable tries to dynamically load a 64
bit module into a running 32 bit cmake, etc, etc) This could be fixed by
running the plugin in a separate process etc but I'm just not sure we really
want to expose/encourage that low level of an API.

Good points though (including the ones I did not touch on) and I do agree
with them. Many of them we have discussed around here in the past.

Ken




More information about the CMake mailing list