[cmake-developers] Suggest if function has lte gte operators

Harry Mallon Harry at codexdigital.com
Fri Apr 8 10:49:42 EDT 2016


That is completely fair. Perhaps a bit of Friday brain from me. It still could reduce complexity if you are trying to do something more complicated.

In my opinion A is easier to read than B.

A: if ( $1 STRGREATER_EQ $2 AND $3 STRLESS $4 AND $5 STRLESS_EQ $6 )
B: if ( NOT $1 STRLESS $2 AND $3 STRLESS $4 AND NOT $5 STRGREATER $6)

H


Harry Mallon
CODEX | Software Engineer
60 Poland Street | London | England | W1F 7NT
E harry at codexdigital.com | T +44 203 7000 989
> On 8 Apr 2016, at 15:42, Ben Boeckel <ben.boeckel at kitware.com> wrote:
>
> On Fri, Apr 08, 2016 at 14:24:08 +0000, Harry Mallon wrote:
>> CMake's "if" functionality is missing greater than or equal to and
>> less than or equal to. This change could be tweaked and added to
>> provide this functionality to avoid things like "if(VERSION_STRING
>> VERSION_GREATER "4.8.0" OR VERSION_STRING VERSION_EQUAL "4.8.0")".
>
> This can also be done as:
>
>    if (NOT VERSION_STRING VERSION_LESS "4.8.0")
>
> I'm ambivalent on the idea of new operators. Documentation for this
> pattern would likely help.
>
> --Ben
>



More information about the cmake-developers mailing list