[cmake-developers] [PATCH] remove "x" placeholder from STREQUAL operands

Ben Boeckel ben.boeckel at kitware.com
Thu Apr 17 22:23:06 EDT 2014


On Thu, Apr 17, 2014 at 17:17:21 -0400, Matthew Woehlke wrote:
> set(" Linux" Windows) # succeeds

Even better:

    set("
    Linux" Windows)

> Alas, the only character that may not appear in a variable name is
> '\0'. (And even that is more due to use of raw char* with no length
> than intent, I bet.)

Actually, it's all std::string now, so you *could* use std::string(nuls,
len) to make one. But that means modifying the CMake code and shouldn't
be possible through CMakeLists.txt.

> I keep hoping that one of these days CMake would define valid
> identifiers as '[[:letter:]_][[:alnum:]_-]*'...

Make a policy for it. Watch the world burn :) . I also don't know where
you'd stick the validator without a decent performance hit (the regex
engine is not the best) :( . May as well stick the restriction on
function and macro names as well. Not that you could call any function
named in such a way, but better safe than sorry.

--Ben



More information about the cmake-developers mailing list