[cmake-developers] New EVIS parser moving forward (3.1)

Ben Boeckel ben.boeckel at kitware.com
Fri Feb 21 16:34:49 EST 2014


On Fri, Feb 21, 2014 at 16:17:37 -0500, Matthew Woehlke wrote:
> Even without a branch, I'll risk stating that requiring 'if(FOO)' to
> become 'if(${FOO})' is not likely to go over well :-). (If nothing
> else, I'll go ahead and object to such a change.) Probably implicit
> expansion should be allowed anywhere the user doesn't think of the
> arguments as strings, e.g. if(LESS), if(VERSION_LESS), etc., i.e.
> everything *except* the string and regex flavors.

>From the if() docs, here's a grouping of what various predicates expect
along with my vote on whether it would make sense to do the implicit
dereference:

    <varname>
    DEFINED
        Variable name

    COMMAND
    POLICY
    TARGET
        CMake object-names

    EXISTS
    IS_NEWER_THAN
    IS_DIRECTORY
    IS_SYMLINK
    IS_ABSOLUTE
        Paths

    LESS
    GREATER
    EQUALS
        Numbers

    MATCHES
    STRLESS
    STRGREATER
    STREQUAL
        Strings (even if the right side of MATCHES is interpreted)

    VERSION_LESS
    VERSION_EQUAL
    VERSION_GREATER
        Version strings

Other than <varname>, I don't really see a huge burden to not allowing
implicit dereferencing and it is more consistent at that point. In fact,
I'd be willing to say in <varname> that we *only* support implicit
dereference, but it may be too hard to detect:

    if (${var})

and actually help users to fix such cases.

--Ben



More information about the cmake-developers mailing list