[CMake] Bug in CMake documentation?

Esben Mose Hansen kde at mosehansen.dk
Sun May 9 06:01:30 EDT 2010


On Sunday 09 May 2010 11:12:54 Esben Mose Hansen wrote:
> I quote from the documentation (2.8)
> 
> >   if(<constant>)
> > 
> >
> > True if the constant is 1, ON, YES, TRUE, Y, or a non-zero number. False
> > if the constant is 0, OFF, NO, FALSE, N, IGNORE, "", or ends in the
> > suffix '-NOTFOUND'. Named boolean constants are case-insensitive.
> 
> So what is the value of say "/home/esben/kde/lib/mylibrary.so"?
> Experimental  test and common sense say true, but the documentation
> doesn't say so. Wouldn't the correct documentation be
> 
>   if(<constant>)
> False if the constant is 0, OFF, NO, FALSE, N, IGNORE, "", or ends in the 
> suffix '-NOTFOUND'. Named boolean constants are case-insensitive. IF the 
> constant has any other value, it is true.
> 
> Right?

Wrong. I made some experiments, and as far as I have been able to determine, 
anything not on the true list (1 being there twice?!) is actually false, 
including non-zero numbers with space appended (but not prefixed) That means 
that the -NOTFOUND suffix is actually quite useless, except perhaps that it 
has a greater chance of being false in the future, too. So true constants 
include

"ON"
"on"
"On"
" 32"

and false constant include

"32 "
"Off"
" ON"
"ON "
"0"
"/usr/lib/libmylib.so"

Very interesting.

-- 
Kind regards, Esben


More information about the CMake mailing list