[CMake] CMake LIST Command: Wiki changes and LIST patch.

Miguel A. Figueroa-Villanueva miguelf at ieee.org
Mon Jun 25 17:56:15 EDT 2007


Hello everyone,

I have made some changes to the wiki page on lists
(http://www.cmake.org/Wiki/CMakeMacroListOperations) to reflect the
new LIST command in CMake 2.4+. I hope I have presented the changes in
an appropriate way.

There is one macro in the wiki page that the current LIST command
couldn't support, the LIST_CONTAINS. This macro provides a
functionality that I believe is quite useful and is in line with the
other LIST command operations. As such, I went ahead and implemented
it in my cmake source tree and have provided a patch for it below. The
changes add the following functionality:

  LIST
       List operations.

         LIST(CONTAINS <list> <value> <output variable>)

       CONTAINS will return TRUE if the element specified is in the list.

SET(MYLIST hello world foo bar)
LIST(CONTAINS MYLIST foo RESULT1)
-- RESULT1: TRUE
LIST(CONTAINS MYLIST baby RESULT2)
-- RESULT2: FALSE


I would like to know if this is a feature of interest to the CMake
developers and if it may be included in future distributions. If not,
I would stick to supporting this through local MACROS.

Also, I would gladly provide a patch for the following two related operations:

1. LIST(CONTAINS <list> <value> [<value> ...] <output variable>) -
returns TRUE if all values are in the <list>

2. LIST(CONTAINS_ANY <list> <value> [<value> ...] <output variable>) -
returns TRUE if any of the values are in the <list>

but I'm not sure if the developers want to keep a simpler interface.
Hence, I would appreciate feedback on whether this is of interest and
if I should open a Feature Request.

Thanks,
--Miguel

-- 
Miguel A. Figueroa Villanueva
+1 787 832-4040 x.3610-4006
Department of Electrical and Computer Engineering
University of Puerto Rico - Mayagüez Campus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cvs.patch
Type: application/octet-stream
Size: 3422 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20070625/e67d8438/cvs.obj


More information about the CMake mailing list