Hi Daniel, <br><br>This sounds like a great feature :), do you think you could also associate a test with your changes ? <br><br>Out of curiosity, why &quot;<i>the right set of include directories is unknown until all components<br>


have been processed</i>&quot; ?<br><br>If it resumes not to be the case, I believe using a CMakeCache variable could do the job. <br><br>For example:<br><br><font style="font-family: courier new,monospace;" size="1"># Clear foo bar<br>

set(FOOBAR_DIRS &quot;&quot; CACHE STRING &quot;Foobar dirs&quot; FORCE)<br><br>...<br><br>add_subdirectory(C)<br>set(C_DIRS ..) # Collect C directories<br>set(FOOBAR_DIRS ${FOOBAR_DIRS} ${C_DIRS} CACHE STRING &quot;Foobar dirs&quot; FORCE)<br>




include_directories(${FOOBAR_DIRS})<br>


add_libraries(C ...)<br><br><br>...<br><br></font><font style="font-family: courier new,monospace;" size="1">add_subdirectory(B)</font><br><font style="font-family: courier new,monospace;" size="1">set(B_DIRS ..) # Collect B directories<br>

set(FOOBAR_DIRS ${FOOBAR_DIRS} ${B_DIRS} CACHE STRING &quot;Foobar dirs&quot; FORCE)<br>
include_directories(${FOOBAR_DIRS})<br>
add_libraries(B ...)<br><br>...<br><br></font><font style="font-family: courier new,monospace;" size="1">add_subdirectory(A)</font><br><font style="font-family: courier new,monospace;" size="1">set(A_DIRS ..) # Collect A directories<br>

set(FOOBAR_DIRS ${FOOBAR_DIRS} ${A_DIRS} CACHE STRING &quot;Foobar dirs&quot; FORCE)<br>
include_directories(${FOOBAR_DIRS})<br>
add_libraries(A ...)</font><br>
<br>Hth<br>Jc<br><br><div class="gmail_quote">On Tue, Jul 12, 2011 at 12:34 PM, Daniel Pfeifer <span dir="ltr">&lt;<a href="mailto:purplekarrot@gmail.com">purplekarrot@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Hi fellows of Ryppl and CMake,<br>
<br>
we are currently in the process of modularizing the Boost C++<br>
Libraries into small individual components. All these components may<br>
depend upon each other, circular dependencies may occur too. We use<br>
CMake to configure, build, test, package etc. We are quite successful.<br>
<br>
Concerning include directories, we make all header files available<br>
from one directory. We do this either with symlinks or with forwading<br>
headers, depending on whether symlinks are possible on that platform<br>
or not. This works, but has several drawbacks:<br>
<br>
1. It is slow. Generating forwarding headers for all headers that we<br>
use is a matter of minutes. We can improve the speed by checking the<br>
existence of files or symlinking directories, but then:<br>
<br>
2. It is fragile. When we add a file header file in a directory that<br>
is forwarded via a symlink we may accidentally put it into the source<br>
directory.<br>
<br>
3. it is not correct. Each component may access all header files. It<br>
should be able to access the headers of its dependency tree only.<br>
<br>
<br>
For a fast, stable, and correct solution, we want to add the right set<br>
of include directories directly, without forwarding anything. However,<br>
the right set of include directories is unknown until all components<br>
have been processed.<br>
<br>
Example: We have the components A, B, C. A depends on B, B depends on<br>
C. Therefore, A should be using the include directories of B and C.<br>
This information however is unknown until the components B and C have<br>
been processed. The include directories cannot be declared while<br>
processing A.<br>
<br>
<br>
The ideal solution for us would be the following:<br>
<br>
&gt; include_directories($&lt;FOOBAR_DIRS&gt;)<br>
&gt; ...<br>
&gt; set(FOOBAR_DIRS /usr/include/foo)<br>
<br>
The generator expression $&lt;FOOBAR_DIRS&gt; is evaluated in the final pass<br>
of the include_directories command. It is possible to &#39;use&#39; the value<br>
FOOBAR_LIBS before it has been set.<br>
<br>
I already implemented the functionality above. The generator<br>
expressions are expanded incrementally and recursive expansion is<br>
taken care of. See: <a href="https://github.com/purpleKarrot/CMake/commit/5f73bcf40fe8b9150bf61afaa3783b56be9e8270" target="_blank">https://github.com/purpleKarrot/CMake/commit/5f73bcf40fe8b9150bf61afaa3783b56be9e8270</a><br>


<br>
Can we get this functionality upstream?<br>
<br>
cheers, Daniel<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><br clear="all"><br>-- <br>+1 919 869 8849<br><br>