Alan W. Irwin wrote: > On 2008-05-07 14:45-0400 Brad King wrote: >> Variable expansion without quotes has *always* >> removed empty items. It occurs before the foreach command even sees >> them and is consistent across all commands. We should not change this. > > I don't agree. For consistency sake with the new CMP0007 policy I think > you > should expand out the empty elements in LIST variables so the two foreach > commands above give consistent results. The current inconsistent results > between explicit lists (as in the first foreach command above) as > opposed to > an expanded LIST variable which contains the same empty and non-empty > elements (as in the second foreach above) are just confusing. So I hope > you > reconsider this decision.
The policy is about the LIST command and how it deals with lists whose *names* are given and not the *values*. This is the FOREACH command which currently always deals with values. A fundmental rule in CMake syntax is that the argument ${MYVAR} expands lists and removes empty elements in all contexts, and the argument "${MYVAR}" is just a string. Changing this rule will be a low-level syntax change to the language and is out of the question, even with a policy. The FOREACH command should have no special exception to this rule. As far as policy CMP0007, the LIST command has no special exception either: set(L1 a b "" c) set(L2 x y) list(APPEND L2 ${L1}) will result in L2 containing "x;y;a;b;c". The ${L1} reference is expanded and cleaned of empty elements before the LIST command is even invoked. The same is true for the arguments of FOREACH. -Brad _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake