<div class="gmail_quote">On Thu, Oct 20, 2011 at 2:36 AM, Rolf Eike Beer <span dir="ltr">&lt;<a href="mailto:eike@sf-mail.de">eike@sf-mail.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">&gt; I have a function defined very high up in the directory tree at the root<br>
&gt; CMakeLists file. Several levels below it, I have another CMakeLists file<br>
&gt; that I call that function from.<br>
&gt;<br>
&gt; The function sets CMAKE_MFC_FLAG to 2. I notice that this flag gets<br>
&gt; ignored<br>
&gt; when it is set inside of the function in question. If I set the flag<br>
&gt; outside<br>
&gt; of the function, in the lowest level CMakeLists file, it works. This<br>
&gt; property seems somehow tied to the directory itself, but I can&#39;t figure<br>
&gt; out<br>
&gt; if this is a feature or a bug.<br>
&gt;<br>
&gt; This behavior isn&#39;t very flexible as I&#39;d like to make the details of<br>
&gt; configuring an MFC compatible project transparent to the lower level<br>
&gt; CMakeLists scripts. Hiding away the flag and how it needs to be set is a<br>
&gt; big<br>
&gt; part of this, but I can&#39;t do it.<br>
&gt;<br>
&gt; Anyone know how I can make this work?<br>
<br>
</div></div>A function creates a new variable scope, i.e. everything you set in there<br>
will be reset once you leave the function. Have a look at SET(...<br>
PARENT_SCOPE) for this.</blockquote><div><br></div><div>Not even that worked, unfortunately.</div><div><br></div><div>Basically from my function I do:</div><div><br></div><div>set( CMAKE_MFC_FLAG 2 )</div><div>add_executable( ... )</div>
<div><br></div><div>Since I&#39;m setting it right before the add_executable() call, I would think that scope has nothing to do with it. </div></div>