I think that you can use an environment variable rather than a normal variable to bypass the normal scoping rules.  So:<br><br>set(ENV{foo} &quot;bar&quot;)<br><br>will I think allow other CMakeFiles to read it using:<br><br>
$ENV{foo}<br><br>regardless of the sub-directory level.  I haven&#39;t tried using this so it may not work but I think it should do what you want.<br><br>--<br>Glenn<br><br><br><div class="gmail_quote">On 19 May 2011 13:05, Eric Noulard <span dir="ltr">&lt;<a href="mailto:eric.noulard@gmail.com">eric.noulard@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;">2011/5/19 J.S. van Bethlehem &lt;<a href="mailto:j.s.van.bethlehem@astro.rug.nl">j.s.van.bethlehem@astro.rug.nl</a>&gt;:<br>

<div class="im">&gt;<br>
&gt; Hello Eike,<br>
&gt;<br>
&gt; Thanks a lot for your reply. I have actually been thinking in the same<br>
&gt; direction. I have one problem though: how can you make a truly global<br>
&gt; variable in CMake? Whenever you do something to a variable in a directory<br>
&gt; that is added using add_subdirectory(), those changes don&#39;t propagate to the<br>
&gt; current directory<br>
&gt; (well, one could use the PARENT_SCOPE option to set() in the sub-directory,<br>
&gt; but then I won&#39;t be able to test that sub-directory seperately because then<br>
&gt; CMake will err that there is no such scope)<br>
&gt;<br>
&gt; How do you deal with this?<br>
<br>
</div>I think, that&#39;s why Eike uses **property** and not variable.<br>
<br>
Property may be at &quot;GLOBAL&quot; scope:<br>
<br>
set_property(&lt;GLOBAL                            |<br>
                       DIRECTORY [dir]                   |<br>
                       TARGET    [target1 [target2 ...]] |<br>
                       SOURCE    [src1 [src2 ...]]       |<br>
                       TEST      [test1 [test2 ...]]     |<br>
                       CACHE     [entry1 [entry2 ...]]&gt;<br>
                      [APPEND]<br>
                      PROPERTY &lt;name&gt; [value1 [value2 ...]])<br>
<br>
       Set one property on zero or more objects of a scope.  The first<br>
       argument determines the scope in which the property is set.  It must<br>
       be one of the following:<br>
<br>
       GLOBAL scope is unique and does not accept a name.<br>
...<br>
<font color="#888888">--<br>
Erk<br>
Membre de l&#39;April - « promouvoir et défendre le logiciel libre » -<br>
<a href="http://www.april.org" target="_blank">http://www.april.org</a><br>
</font><div><div></div><div class="h5">_______________________________________________<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>
</div></div></blockquote></div><br>