[CMake] unset() command

Alan W. Irwin irwin at beluga.phys.uvic.ca
Wed Aug 20 17:14:21 EDT 2008


On 2008-08-20 14:07-0400 Brad King wrote:

> Alan W. Irwin wrote:
>> if(FOO)
>>
>> still gives different results depending on whether there has ever been a
>> set command executed for the variable.
>
> Really?  Can you provide example code demonstrating this?

OOPS.  Sorry for that noise.

However, I would like to point out there is still a documentation concern
here.  Here is what is stated about DEFINED

if(DEFINED variable)

  True if the given variable is defined.  It does not matter if the
  variable is true or false just if it has been set.

So if you interpret the command "set(FOO)" as setting the variable, then the
documentation implies

if(DEFINED FOO)

will be true, but in fact my tests show it is false (both in 2.4.8 and
2.6.0) just like you stated.  A small addition to this area of the
documentation concerning the special case of set(variable) (i.e., with no
value) is warranted.  Also, the documentation for the SET command currently
(2.6.1) says the variable is removed from the parent scope when there is no
value. Shouldn't you either drop the "parent" adjective (or better yet in my
view) simply say the variable is undefined (as if it had never been set),
instead?

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list