<div class="gmail_quote">On Thu, Oct 20, 2011 at 2:36 AM, Rolf Eike Beer <span dir="ltr"><<a href="mailto:eike@sf-mail.de">eike@sf-mail.de</a>></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">> I have a function defined very high up in the directory tree at the root<br>
> CMakeLists file. Several levels below it, I have another CMakeLists file<br>
> that I call that function from.<br>
><br>
> The function sets CMAKE_MFC_FLAG to 2. I notice that this flag gets<br>
> ignored<br>
> when it is set inside of the function in question. If I set the flag<br>
> outside<br>
> of the function, in the lowest level CMakeLists file, it works. This<br>
> property seems somehow tied to the directory itself, but I can't figure<br>
> out<br>
> if this is a feature or a bug.<br>
><br>
> This behavior isn't very flexible as I'd like to make the details of<br>
> configuring an MFC compatible project transparent to the lower level<br>
> CMakeLists scripts. Hiding away the flag and how it needs to be set is a<br>
> big<br>
> part of this, but I can't do it.<br>
><br>
> 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'm setting it right before the add_executable() call, I would think that scope has nothing to do with it. </div></div>