Am 2012-08-20 14:00, schrieb Brad King:
On 08/19/2012 08:09 AM, Rolf Eike Beer wrote:
I'm wondering if it makes sense to do a mass replace of

foreach(listvar ${somevar})

to

foreach(listvar IN LISTS somevar)

From what I see this should be more efficient as the variable is not first expanded and then parsed again, it could save from potential trouble if e.g. somevar includes elements with spaces, and it should not introduce any further
hassle.

The main difference in behavior is when the list contains empty elements.
The former will remove them.  The latter will include them.

Try running some timings in isolated test cases to see if there is really
much difference in efficiency.

The gain in efficiency would be just a bonus. My main concern is that the current use may happily cause trouble in most cases when an input path contains spaces or semicolons because of missing quoting and escaping. And most of them build up those lists by hand anyway so we are sure on most cases that empty elements are not present anyway.

Eike
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to