[CMake] CMake with Lua Experiment

Juan Sanchez Juan.Sanchez at amd.com
Tue Nov 27 15:22:43 EST 2007



Brandon Van Every wrote:
> On Nov 27, 2007 2:32 PM, Brandon Van Every <bvanevery at gmail.com> wrote:
>> On Nov 26, 2007 3:55 PM, Brandon Van Every <bvanevery at gmail.com> wrote:
>>> I noticed the "unpack" command.
>>>
>>> sources = {
>>>   "simpleLib.cxx",
>>>   "simpleCLib.c",
>>>   "simpleWe.cpp"
>>> }
>>>
>>> cm_add_library ("simpleLib", "STATIC", unpack(sources));
>>>
>>> Would this be necessary / paradigmatic in Lua?  In CMake I just use lists.
>> Reading the Lua docs, it seems one uses a table instead of a list.
>> There's a shorthand for calling a function that has 1 table as its
>> argument: f{whatever} instead of f({whatever}).  So I think the above
>> could have been:
>>
>> cm_add_library{"simpleLib", "STATIC", "simpleLib.cxx", "simpleCLib.c",
>> "simpleWe.cpp"}
>>
>> and of course the function would have to handle the table
>> appropriately.
> 
> Lua also has a varargs interface via ... so there's no reason this has
> to be done with a table.  But I guess you knew that already.  So, the
> real wart is that in CMake we only have to type ${sources} and in Lua
> we'd have to type unpack(sources) all the time.  That's gonna get old.
> 
>> Now I'll see if we can get rid of all those pointless quotes.
> 
> It doesn't look possible.  That's annoying.

How about?

cm_add_library{"simpleLib STATIC simpleLib.cxx simpleCLib.c simpleWe.cpp"}


Regards,

Juan

> 
> 
> Cheers,
> Brandon Van Every
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
> 
> 


-- 
Juan Sanchez
Juan.Sanchez at amd.com
800-538-8450 Ext. 54395
512-602-4395




More information about the CMake mailing list