[CMake-Promote] Language barrier

E. Wing ewmailing at gmail.com
Fri Dec 23 20:58:04 EST 2005


I did a little bit of searching for opinions on the web about CMake vs. SCons.
Here are two quotes that seem to represent the biggest reoccurring
theme I found:

- scons/python seemed better than learning to use the cmake scripting language

- However, the cmake templates themselves seemed harder and since I
already key some python, I chose scons in the end.



I think the biggest barrier to adoption of CMake is the language. (And
I struggle with the language myself at times.)

It seems that if you had a language that people were familiar with,
the language argument would go away and CMake would be solely judged
by its project generation capabilities (where CMake excels).

I know this is a non-trivial task, but have you considered adopting a
secondary language that people can write project descriptions in? For
example, if you could write CMake descriptions in Python instead of
the current language, most of the SCons vs CMake discussion would die
immediately.

Now I personally wouldn't recommend Python to start with. Embedding a
Python interpreter seems like total overkill as Python has libraries
up the wazoo which CMake doesn't really need. And I don't actually
know the language so I could be wrong, but the language semantics look
like they might be overkill too as Python's strength seems to be with
object oriented programming which doesn't really appear in CMake.

But I would recommend looking at Lua. Lua is designed to be a simple
extensible extension language. It's small, lightweight, and fast. The
language is considered by many to be very easy to learn and is the
dominant scripting language used by the video game industry. Since the
language was designed to be embedded, it has a clean C interface API
so communicating between your core C/C++ engine and the Lua scripts is
fairly straightforward. The Lua core is written in 100% ANSI C so it
ports everywhere. The core is about 80k compiled (depending on flags,
platform).

The language itself might make a better mapping to the current CMake
language than Python. Also Lua 5.1 (which is now in beta, expected to
go final probably next month) has mentioned a new macro facility which
has gotten a lot of people thinking. One potential use of it is to
allow mapping between the general Lua language to a more domain
specific language. I don't know how far this idea can be extended but
it might be used to bridge syntactic differences between the existing
CMake language and Lua.

Adopting Lua as a secondary language might encourage users to take a
more serious look at CMake if the language is the concern. Lua is a
considerably smaller community than Python, but Lua tends to have a
good reputation and people seem to be at least open-minded to Lua if
it could serve their purposes, especially if there is potential they
can reuse what they've learned in other things.

There don't seem to be a lot of language zealots for Lua like there
are for Perl, Python, Ruby, PHP, Java, etc, so you probably won't get
as big of an evangelism push as the Python people give SCons. Hardcore
Lua users seem to have a wide background of many different obscure and
esoteric languages and are very open to new languages. But I think
that's also the attraction of Lua for users. They tend to prefer
picking the best tools to accomplish their jobs. Since Lua is designed
to interact with C, Lua users have a good understanding that some jobs
are better suited in low level languages like C, while other things
are more elegantly done in high level languages. With the other
languages, people seem to have the mentality, "Everything should be
done in this language."

So ironically, the lack of zealotry might actually be a benefit. Most
Perl, Python, Java, etc programmers I know will do everything in their
native language. Those languages don't really need cross-platform
build systems like CMake. For CMake, we're asking mostly C/C++
programmers to use a scripting language for their build system.
There's a chance that these programmers have used Lua before so it
will be natural for them, but if not, there's a chance they could use
Lua in their future C/C++ projects so learning Lua for their build
system might be considered efficient use of their time.

So adopting Lua as a second language could possibly work out well from
a marketing/adoption standpoint. The Lua community would certainly
welcome such a valuable tool like CMake. And CMake could leverage
Lua's excellent documentation and user base. The Lua creator has
self-published a well-written book called "Programming In Lua" which
is available for free on the Lua website and for purchase for a
physical book if you want to learn more about Lua.

Thanks,
Eric


More information about the CMake-Promote mailing list