<div dir="ltr">On Wed, Aug 20, 2008 at 10:54 AM, Brad King <span dir="ltr"><<a href="mailto:brad.king@kitware.com">brad.king@kitware.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
The "set" command already supports unsetting:<br>
<br>
set(FOO xyz)<br>
set(FOO) # unsets<br>
if(DEFINED FOO)<br>
message("This message does not appear.")<br>
endif(DEFINED FOO)<br>
<br>
I think it should just be fixed for CACHE and ENV variables.</blockquote><div><br>I knew that set() supported unsetting local variables but wasn't sure it would be safe to extend it to CACHE and ENV variables as a bugfix. Regardless of whether this is appropriate to do or not adding an unset() command also seemed to make the language simpler to understand because:<br>
set(FOO)<br>as someone else pointed out, is somewhat confusing. Without referencing the documentation many programmers might think this defines a variable called FOO and sets it to empty but what it really is doing is *undefining* the variable FOO entirely if it exists.<br>
</div></div><br>-- <br>Philip Lowman<br>
</div>