[cmake-developers] lua bindings?

Doug douglas.linder at gmail.com
Fri Aug 3 00:14:06 EDT 2012


I'm quite curious about the possibility of writing a lua binding for cmake.

There are two possible ways to go:

1) Create a set of discrete lua bindings which actually invoke cmake itself.

2) Integrate lua into cmake itself.

Before I go and do anything, has any effort been made to do either of these?

>From the lua mailing list I get the impression that some discussion of
(2) has been done before, and broadly speaking, no one is really
interested in re-writing cmake to support lua scripts as first class
citizens.

However, (1) interests me, because it'd be reasonably trivial to
implement a lua binding of commands like:

cmake:execute_process
cmake:add_library
cmake:target_link_library

That cached the requests internally and actually generated a
cmakelists.txt from it.

There are some difficulties with this approach, for example, some
actions require an immediate response that can't be cached; eg.
file(GLOB) -> filtering that list to invoke add_library()... but I
think it wouldn't be impossible to generate temporary 'working' cmake
files and invoke cmake on them directly, read the response and pipe it
back into the lua script.

This would be effectively a zero-impact wrapper around cmake, and make
supporting more complex programming constructs (poor support for
closures, hashes and lists specifically being my pet dislike with the
cmake language).

So, like I said, before I start down the road of messing around with
this, has anyone got any thoughts about it, past experience and
suggestions?

Cheers,
Doug.



More information about the cmake-developers mailing list