[cmake-developers] Support for list length expression in if()-command?

Brad King brad.king at kitware.com
Tue Jan 22 06:42:40 EST 2019


On 1/22/19 3:08 AM, Torsten at Robitzki.de wrote:
> three use cases:
> 
> - Checking for empty lists (I’ve showed him that this can be done
>   by a string compare).
> - Checking for lists having more than 1 entry
> - Checking for equal size of two lists. For example, if you want
>   to pass pairs or tuples to a function. (example: f(firsts seconds))

Rather than a special `if` syntax, perhaps we could introduce an
explicit `$LIST_LENGTH{mylist}` syntax.  One would need to experiment
to see if modifying the variable expansion parser (under CMP0053 NEW
behavior only) to support this would have a significant performance
impact.

-Brad


More information about the cmake-developers mailing list