I actually found that using the following worked the exact same for me:<div><br></div><div>set( var &quot;&quot; PARENT_SCOPE )</div><div><br></div><div>It passed the &quot;NOT&quot; test in my if condition:</div><div><br>
</div><div>if( NOT var )</div><div>...</div><div>endif()</div><div><br></div><div>It might make more sense to require 2 parameters for set() (the variable name and its value). If setting to nothing, use a blank string. That way there is no ambiguity between PARENT_SCOPE and parameter 2.</div>
<div><br></div><div>If people really want to unset the variable, I don&#39;t believe set() is the way... that&#39;s why unset() exists. Just my opinion. Only problem is, if you make this change, it isn&#39;t backward compatible and will probably break a lot of scripts. Looks like CMake is kind of boned here. Herb Sutter made a great point during GoingNative 2012 about how it&#39;s better to &quot;not have a feature&quot; than to misdesign it and be stuck supporting it forever. I think the latter part of the statement applies here :)</div>
<div><br></div><div>This isn&#39;t a big deal though, just one of those &quot;if we could change it, this would make more sense&quot; kind of things.</div><div><br></div><div>Big thanks for your help David, as usual.<br clear="all">
<div><br></div><div>---------</div>Robert Dailey<br>
<br><br><div class="gmail_quote">On Thu, Feb 9, 2012 at 6:19 PM, David Cole <span dir="ltr">&lt;<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Yes, PARENT_SCOPE must occur as the last argument. Each command has its own code for processing its argument list. See Source/cmSetCommand.cxx for details on this one.<br><br><div>Interesting (not quite the right adjective?) side effect: it&#39;s difficult to set a variable to the value &quot;PARENT_SCOPE&quot; because you have to do it indirectly...</div>
<div class="HOEnZb"><div class="h5">
<div><br></div><div><br><div class="gmail_quote">On Thu, Feb 9, 2012 at 7:12 PM, Robert Dailey <span dir="ltr">&lt;<a href="mailto:rcdailey@gmail.com" target="_blank">rcdailey@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

That worked, thanks David.<div><br></div><div>I guess CMake goes right-to-left for function parameters? I don&#39;t see how else it doesn&#39;t think PARENT_SCOPE is a value instead of an option.<br clear="all"><div><br>
</div>

<div>---------</div><span><font color="#888888">Robert Dailey</font></span><div><div><br>
<br><br><div class="gmail_quote">On Thu, Feb 9, 2012 at 1:45 PM, David Cole <span dir="ltr">&lt;<a href="mailto:david.cole@kitware.com" target="_blank">david.cole@kitware.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div class="gmail_quote"><div>On Thu, Feb 9, 2012 at 2:41 PM, Robert Dailey <span dir="ltr">&lt;<a href="mailto:rcdailey@gmail.com" target="_blank">rcdailey@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



I didn&#39;t try that because I thought it would actually treat PARENT_SCOPE as a string and add it to the variable. I did this instead:<div><br></div><div>set( var &quot;&quot; PARENT_SCOPE )<br clear="all"></div></blockquote>



<div><br></div></div><div>That leaves it set, with a value of the empty string, in the parent scope. Give the one I sent a try.</div><div><div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div><div><br></div>
<div>---------</div><span><font color="#888888">Robert Dailey</font></span><div><div><br>
<br><br><div class="gmail_quote">On Thu, Feb 9, 2012 at 1:26 PM, David Cole <span dir="ltr">&lt;<a href="mailto:david.cole@kitware.com" target="_blank">david.cole@kitware.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div class="gmail_quote"><div><div>On Thu, Feb 9, 2012 at 2:22 PM, Alexander Neundorf <span dir="ltr">&lt;<a href="mailto:a.neundorf-work@gmx.net" target="_blank">a.neundorf-work@gmx.net</a>&gt;</span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
<div>On Thursday 09 February 2012, Robert Dailey wrote:<br>
&gt; It would seem useful to have a PARENT_SCOPE option for the unset() command,<br>
&gt; just like its set() counterpart. Is there a particular reason why it does<br>
&gt; not have it now?<br>
<br>
</div>No, I think there is not particular reason.<br>
<br>
Alex<br>
</div></div><span><font color="#888888">--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</font></span></blockquote></div><br><div><br></div><div>Does:</div><div><br></div><div>  set(var PARENT_SCOPE)</div><div><br></div><div>have the intended effect?</div><div><br></div><div>(If so, you could use that until such time as PARENT_SCOPE is added to unset.)</div>





<div><br></div>
<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br></div></div></div>
</blockquote></div></div></div><br>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>