On Sunday 09 May 2010 18:01:32 you wrote:
> Yes.
> The argument to if() is the name of a variable.
> So in 
> IF ("/var/lib")
> cmake checks whether the variable named "/var/lib" has a TRUE value. This 
> variable most probably does not exist, so it returns false.
> In 
> IF (MYVAR)
> cmake checks whether the variable named "MYVAR" has a TRUE value, now the 
> value exists as "/var/lib", so it returns true.

Wonderful. I tested it, and you are correct. It is even more fun, actually. If 
CMP0012 is on the NEW behaviour (which it is from 2.8.0 onwards), certain 
constants  are recognized before dereferencing, while the old behaviour 
"always derefences except for 0 and 1". (I think they also do not derefence 
for numbers in general, but that's what it says). 

I naively thought that "Constants" would be something usual like strings or 
numbers, but apparently constants are only loosely defined in that policy as 
"such as true, false, yes, no, on, off, y, n, notfound, ignore" --- there are 
no real definition of what a "constant" is anywhere in the manual from a quick 
search. From the language, I suspect that "constant" is short for "boolean 
constants", in which case it would be the above strings + numbers. I think. 
This also means that lists are squashed and tested directly for the above 
strings for falseness, explaining the weird behaviour you documented in 
further up the thread.

Well, as long as you know whats going on :) Thank you greatly for your help.

-- 
Kind regards, Esben
_______________________________________________
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://www.cmake.org/mailman/listinfo/cmake

Reply via email to