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
-- 

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to