<div class="gmail_quote">On Sat, Apr 4, 2009 at 5:13 AM, elizabeta petreska <span dir="ltr">&lt;<a href="mailto:elizabeta.petreska@gmail.com">elizabeta.petreska@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thanks for the help.<div>I&#39;m sorry if my question was not clear enough or maybe I don&#39;t understand your answer</div><div><br><div>My question was how the parent directory may inherit the include directories from the child directory (added with add_subdirectory)  ?</div>

<div><br></div><div> The current behavior is that the include directories from the child directory are added to the list of includes in the parent.</div></div></blockquote><div><br>Elizabeta,<br><br>Provided the directory name is an absolute path I think you could use the PARENT_SCOPE option to set() to pass the include directories up a directory to the parent.  This is provided you&#39;re using CMake &gt;= 2.6.0.  If you are on 2.4.x or have to pass variables up many directories there are alternatives to this that will effectively provide you global variables (was a recent thread on the mailing list about this).<br>
<br><b>parent_dir/CMakeLists.txt:<br></b>add_subdirectory(child_dir)<br>include_directories(${my_include_dirs})<br><br><b>    child_dir/CMakeLists.txt:<br></b>    set(my_include_dirs ${FOO_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/another_child_dir) # can&#39;t use relative paths here<br>
    include_directories(${my_include_dirs})<br>    set(my_include_dirs ${my_include_dirs} PARENT_SCOPE)<br></div></div><br>-- <br>Philip Lowman<br>