<div dir="ltr">On Thu, Aug 21, 2008 at 9:01 AM, Brad King <span dir="ltr">&lt;<a href="mailto:brad.king@kitware.com">brad.king@kitware.com</a>&gt;</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;">
<div class="Ih2E3d">Philip Lowman wrote:<br>
&gt; On Wed, Aug 20, 2008 at 10:54 AM, Brad King &lt;<a href="mailto:brad.king@kitware.com">brad.king@kitware.com</a><br>
</div><div><div></div><div class="Wj3C7c">&gt; &lt;mailto:<a href="mailto:brad.king@kitware.com">brad.king@kitware.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt; &nbsp; &nbsp; The &quot;set&quot; command already supports unsetting:<br>
&gt;<br>
&gt; &nbsp; &nbsp; set(FOO xyz)<br>
&gt; &nbsp; &nbsp; set(FOO) # unsets<br>
&gt; &nbsp; &nbsp; if(DEFINED FOO)<br>
&gt; &nbsp; &nbsp; &nbsp;message(&quot;This message does not appear.&quot;)<br>
&gt; &nbsp; &nbsp; endif(DEFINED FOO)<br>
&gt;<br>
&gt; &nbsp; &nbsp; I think it should just be fixed for CACHE and ENV variables.<br>
&gt;<br>
&gt;<br>
&gt; I knew that set() supported unsetting local variables but wasn&#39;t sure it<br>
&gt; would be safe to extend it to CACHE and ENV variables as a bugfix.<br>
&gt; Regardless of whether this is appropriate to do or not adding an unset()<br>
&gt; command also seemed to make the language simpler to understand because:<br>
&gt; &nbsp; &nbsp;set(FOO)<br>
&gt; as someone else pointed out, is somewhat confusing. &nbsp;Without referencing<br>
&gt; the documentation many programmers might think this defines a variable<br>
&gt; called FOO and sets it to empty but what it really is doing is<br>
&gt; *undefining* the variable FOO entirely if it exists.<br>
<br>
</div></div>Okay, I agree. &nbsp;It will be easier and more readable to add the unset<br>
command than to extend the &quot;set&quot; command to &quot;unset&quot; things :)<br>
<br>
However, this:<br>
<br>
 &nbsp;unset(MY_CACHE_VARIABLE)<br>
<br>
should not remove the cache entry. &nbsp;It should only unset the CMake<br>
variable. &nbsp;In order to remove the cache entry, we should require<br>
<br>
 &nbsp;unset(MY_CACHE_VARIABLE CACHE)<br>
<br>
Otherwise there is no way to remove the variable without removing the<br>
cache entry.<br>
<br>
One nice thing about the unset command is that it doesn&#39;t make sense to<br>
provide a value. &nbsp;Therefore we can add extra arguments like &#39;CACHE&#39;<br>
without ambiguity.</blockquote><div><br>That makes sense.&nbsp; Would you like me to fix the patch and resubmit?<br></div></div><br>-- <br>Philip Lowman<br>
</div>