[cmake-developers] $LIST_LENGTH{} syntax
Brad King
brad.king at kitware.com
Tue Jan 22 11:03:26 EST 2019
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 new if() operator potentially
requires a policy, and there may be other places that the length of
a list is useful.
> Or introduce a more general syntax for list management as part
> of an expression:
> $LIST{<op>,<list>[,<arg>,…]}
>
> Where <op>, <list> and <arg> use same semantic as list command.
> To use it:
> of ($LIST{LENGTH,my_list} EQUAL 1)
> # do my stuff
> endif()
Yes, something more extensible would be fine. We need to be careful
not to slow down the variable reference syntax parser though.
-Brad
More information about the cmake-developers
mailing list