Re: [cmake-developers] $LIST_LENGTH{} syntax

2019-01-22 Thread Ben Boeckel via cmake-developers
On Tue, Jan 22, 2019 at 19:31:43 +0100, tors...@robitzki.de wrote: > Currently, the Code that evaluates the ${}-Syntax only evaluates the key, if > the key is not an empty string: > > const char* cmCommandArgumentParserHelper::ExpandSpecialVariable( > const char* key, const char* var) > { > i

Re: [cmake-developers] $LIST_LENGTH{} syntax

2019-01-22 Thread Brad King via cmake-developers
On 1/22/19 1:31 PM, tors...@robitzki.de wrote: > Currently, the Code that evaluates the ${}-Syntax only evaluates the key > > const char* cmCommandArgumentParserHelper::ExpandSpecialVariable( That's the pre-CMP0053 impl. See cmMakefile::ExpandVariablesInStringNew for the modern impl. Only with C

Re: [cmake-developers] $LIST_LENGTH{} syntax

2019-01-22 Thread Torsten
> Am 22.01.2019 um 17:03 schrieb Brad King : > > Yes, something more extensible would be fine. We need to be careful > not to slow down the variable reference syntax parser though. Currently, the Code that evaluates the ${}-Syntax only evaluates the key, if the key is not an empty string: co

Re: [cmake-developers] $LIST_LENGTH{} syntax

2019-01-22 Thread Brad King via cmake-developers
On 1/22/19 10:55 AM, Marc CHEVRIER wrote: > What about introducing a syntax similar to the version comparison: > > * LENGTH_EQUAL > * LENGTH_GREATER > * LENGTH_LOWER > * etc… > > To use it: > if (my_list LENGTH_EQUAL 1) >   # do my stuff > endif() That's where this thread started. Every

Re: [cmake-developers] $LIST_LENGTH{} syntax (was: Support for list length expression in if()-command?)

2019-01-22 Thread Robert Maynard via cmake-developers
I like some syntax that looks like $LEN{}. I would love to keep the $...{ syntax open for future exentsion such as easy target property set/get ( $[prop_name]{target} ) . This seems to be okay as $ENV, and $CACHE only work on variables, so therefore adding $LEN that also only works on variables se

Re: [cmake-developers] $LIST_LENGTH{} syntax (was: Support for list length expression in if()-command?)

2019-01-22 Thread Brad King via cmake-developers
On 1/22/19 7:40 AM, Daniel Franke wrote: > Whats about a Syntax like > > ${list::LENGTH} That would require dispatch after matching `${VAR}` syntax, and that lookup is one of the hottest paths according to profiling. We already have $ENV{} and $CACHE{} syntax. -Brad -- Powered by www.kitware.c

Re: [cmake-developers] $LIST_LENGTH{} syntax (was: Support for list length expression in if()-command?)

2019-01-22 Thread Brad King via cmake-developers
On 1/22/19 7:09 AM, tors...@robitzki.de wrote: >> 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 CMP005