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

2019-01-22 Thread Torsten
> Am 22.01.2019 um 12:42 schrieb Brad King : > > > 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 wou

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

2019-01-22 Thread Brad King via cmake-developers
On 1/22/19 3:08 AM, tors...@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

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

2019-01-22 Thread Torsten
Hi Brad, > Am 14.01.2019 um 12:44 schrieb Brad King : > > I've almost never needed to test the length of a list in CMake > code. It's not very common in my experience. What is your > customer trying to do? Sorry for the late response! I’ve asked him. Mainly, he has three use cases: - Checking

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

2019-01-14 Thread Brad King via cmake-developers
On 1/14/19 4:21 AM, Torsten Robitzki wrote: > if (LENGTH list GREATER 1) An investigation will be needed to determine whether a policy is needed to add this to the if() command to avoid possible behavior changes for existing callers. For reference, you asked this previously: https://cmake.org/

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

2019-01-14 Thread Torsten Robitzki
Hi, I have a customer that requires quite often to check, whether a list contains at least a given number of elements. As we do not have functions with return values, this requires him to inquire the length of a list before taking special actions. To simplify that task (and without larger chang