View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003986CMakeCMakepublic2006-10-27 11:052016-06-10 14:21
ReporterTristan Carel 
Assigned To 
PrioritylowSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionCMake 3.6Fixed in VersionCMake 3.6 
Summary0003986: LIST(FILTER <list> <regex> [<regex> ...] [OUTPUT_VARIABLE <variable>])
DescriptionSYNOPSIS:
LIST(FILTER <list> <regex> [<regex> ...] [OUTPUT_VARIABLE <variable>])

FILTER removes items from <list> which do not match any of the
specified regular expressions. An optional argument OUTPUT_VARIABLE
specifies a variable in which to store the matched items instead of
updating <list>.

Thank you
--
Tristan
TagsNo tags attached.
Attached Filestxt file icon CMakeLists.txt [^] (399 bytes) 2016-01-16 11:59 [Show Content]

 Relationships

  Notes
(0008549)
Alex Neundorf (developer)
2007-08-21 13:38

What's the use case ?
(0008633)
Tristan Carel (reporter)
2007-08-23 16:09

Do you want an example of how to use it or me to explain how useful it can be?


Here is an example to extract CPACK variables defined in environment:

---------------------------------------
GET_CMAKE_PROPERTY(cpack_variables VARIABLES)
LIST(FILTER cpack_variables "^CPACK.+")
---------------------------------------

or by using the optional parameter:
---------------------------------------
GET_CMAKE_PROPERTY(variables VARIABLES)
LIST(FILTER variables "^CPACK.+" OUTPUT_VARIABLE cpack_variables)
---------------------------------------

which is much more concise and lisible than doing is manually. Users don't have to filter lists manually with FOREACH statement anymore, which can be source of many errors. With several criteria, the code becomes as huge as repetitive.
The optional argument avoid user to make a copy before using the command in case he wants to keep the previous content.

Hope this answer the question
(0008636)
Alex Neundorf (developer)
2007-08-23 16:26

There are so many things which can be done with lists.
This sounds a bit very special.
Can't this be wrapped in a macro ?
(0008798)
Tristan Carel (reporter)
2007-09-01 03:55

I wish list filtering to be a `real' CMake command as I believe this is a common operation.

Write a macro, and add it to the wiki (in http://cmake.org/WIKI/CMakeMacroListOperations [^]) is quiet useless because the rookie CMake user doesn't know about this page.
Maybe the solution would be to ease accessibility of this wiki page by adding the url in the official LIST documentation.
Also this would promote user contributions.
(0025741)
Alex Neundorf (developer)
2011-03-10 15:13

I don't feel like working on this, maybe somebody else picks it up.

(0025746)
Alex Neundorf (developer)
2011-03-10 15:25

The "backlog" status is intended to be used for this.

Alex
(0040248)
Ashley Whetter (reporter)
2016-01-16 12:01

I'm about to submit a patch for this but if it's decided that using a macro would be more appropriate then I've uploaded a sample macro here that will do the same thing.
(0040251)
Ashley Whetter (reporter)
2016-01-17 17:11

For reference, here is a link to the submitted patch: http://public.kitware.com/pipermail/cmake-developers/2016-January/027494.html [^]
(0040432)
Brad King (manager)
2016-02-03 11:18

I've applied the patch proposed here:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/15496/focus=15606 [^]

as:

 list: Add FILTER subcommand
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0205f882 [^]
(0041266)
Kitware Robot (administrator)
2016-06-10 14:21

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2007-08-21 13:38 Alex Neundorf Note Added: 0008549
2007-08-21 13:38 Alex Neundorf Assigned To System Admin => Alex Neundorf
2007-08-21 13:38 Alex Neundorf Category => Test Category
2007-08-23 16:09 Tristan Carel Note Added: 0008633
2007-08-23 16:26 Alex Neundorf Note Added: 0008636
2007-09-01 03:55 Tristan Carel Note Added: 0008798
2011-03-10 15:13 Alex Neundorf Note Added: 0025741
2011-03-10 15:13 Alex Neundorf Assigned To Alex Neundorf =>
2011-03-10 15:13 Alex Neundorf Summary LIST(FILTER <list> <regex> [<regex> ...] [OUTPUT_VARIABLE <variable>]) => LIST(FILTER <list> <regex> [<regex> ...] [OUTPUT_VARIABLE <variable>])
2011-03-10 15:13 Alex Neundorf Description Updated
2011-03-10 15:25 Alex Neundorf Note Added: 0025746
2011-03-10 15:25 Alex Neundorf Status assigned => backlog
2016-01-16 11:59 Ashley Whetter File Added: CMakeLists.txt
2016-01-16 12:01 Ashley Whetter Note Added: 0040248
2016-01-17 17:11 Ashley Whetter Note Added: 0040251
2016-02-03 11:18 Brad King Note Added: 0040432
2016-02-03 11:18 Brad King Status backlog => resolved
2016-02-03 11:18 Brad King Resolution open => fixed
2016-02-03 11:18 Brad King Fixed in Version => CMake 3.6
2016-02-03 11:18 Brad King Target Version => CMake 3.6
2016-06-10 14:21 Kitware Robot Note Added: 0041266
2016-06-10 14:21 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team