[CMake] some comments on the LIST command
Gaetan Lehmann
gaetan.lehmann at jouy.inra.fr
Fri May 12 03:24:37 EDT 2006
On Fri, 12 May 2006 00:40:25 +0200, Alexander Neundorf
<a.neundorf-work at gmx.net> wrote:
> Hi,
>
>> Von: Gaetan Lehmann <gaetan.lehmann at jouy.inra.fr>
>>
>> Hi,
>>
>> We have implemented for WrapITK some list functions in pure cmake. It
>> would be
>> nice to be able to replace them by native functions. Some of them are
>> already
>> there (SORT for example), but some are missing:
>> - LIST(UNIQUE <list>) remove all the duplicate items in the list.
>> - LIST(INTERSECT <list> <element> [<element> ...]) compute the
>> intersection
>> of the list and the list of element given in parameter. I think the
> output
>> variable should not contain any duplicate item, but it should be
>> discussed.
>> - LIST(HAS_ITEM <list> <item> <output variable>) set output variable
> to
>> ON if
>> the item is in the list, and to OFF otherwise.
>>
>> Also, I'm surprised to see that the LIST commands always modify the
> list,
>> and
>> does not produce a new one. It is definitively not always the desired
>> behavior. It is not a important issue - some macro can easily be
>> created to workaround that.
> You could just use SET() to create a copy beore the LIST() command.
>
>> Finally, I think REMOVE and REMOVE_ITEM should be swapped - for me, the
>> item
>> is what is removed from the list, not its index. Currently, we have:
>>
>> LIST(REMOVE <variable> <value> [<value> ...])
>> LIST(REMOVE_ITEM <variable> <index> [<index> ...])
> Maybe REMOVE_VALUE and REMOVE_INDEX ?
yes :-)
And I forgot a missing command:
LIST(REMOVE_VALUES <list> <element> [<element> ...]) to remove all the
element in the list, not only the first one.
SET(list 1 1 2 2 3 4)
LIST(REMOVE_VALUE list 1) # list is 1 2 2 3 4
LSIT(REMOVE_VALUES list 2) # list is 1 3 4
Gaetan
--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
http://voxel.jouy.inra.fr
More information about the CMake
mailing list