[CMake] NOT operator gotchas for newbies

Dan Kegel dank at kegel.com
Fri Nov 4 22:24:13 EDT 2011


On Fri, Nov 4, 2011 at 6:09 PM, Michael Hertling <mhertling at online.de> wrote:
> NOT isn't a constant but a boolean operator like AND/OR/EXISTS etc.,
> and none of the latters is case-sensitive at the moment, so why
> should NOT be the sole exception?

Right, I meant to suggest the other operators should be
case insensitive, too.  Isn't that the general direction cmake
has been going?

>> Also, people who mistakenly use !foo instead of NOT foo
>> get a surprise: the result is always silently false.
>> It might be nice to catch this possibly common error
>> and output an error message.
>
> !foo seems to be a valid indentifier for a variable ...
> Besides the fact that you can not refer to it via ${!foo}, it's highly
> inadvisable to name a variable in this way, of course. Anyway, if one
> considers to introduce "!" as an equivalent for NOT,

I was proposing instead to output a good error message
in this case, not to support ! as a synonym for NOT.
(Whew, that's a lot of negatives.)
- Dan


More information about the CMake mailing list