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

Torsten Robitzki Torsten at Robitzki.de
Mon Jan 14 04:21:37 EST 2019


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 changes in CMake [like introducing *real* functions]), he came up with the idea to extend the if()-command with a LENGTH operator:

set(list)

…

if (LENGTH list GREATER 1)
…
endif()

Would such an extension be accepted as pull request, if we would provide it?

regards,

Torsten

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <https://cmake.org/pipermail/cmake-developers/attachments/20190114/0dd8ac2d/attachment.sig>


More information about the cmake-developers mailing list