On Tue, Sep 28, 2010 at 12:22 PM, Alexander Neundorf <span dir="ltr"><<a href="mailto:neundorf@kde.org">neundorf@kde.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div class="im">On Tuesday 28 September 2010, David Cole wrote:<br>
> Ambitious. I like it.<br>
><br>
> I would prefer seeing this implemented as a CMake-language function. And<br>
<br>
</div>You mean to implement this as a cmake script, and not as a built-in function ?<br>
<div class="im"><br>
> adding anything necessary to CMake in order to support implementing it in<br>
> the CMake language.<br>
><br>
> (Because I think that adding such support would also enable a slew of other<br>
> unthought-of-as-yet functionality that will prove extremely useful...)<br>
><br>
> However, if that's not possible, or not your cup of tea, I would not fight<br>
> against including a native command to implement this functionality.<br>
><br>
> One problem I foresee with this right from the get-go is that it is very<br>
> complex and will be difficult to test well. And possibly difficult to<br>
> figure out what's gone wrong when something does go wrong.<br>
><br>
> You have time to prototype this in the CMake language and tell us what new<br>
> functionality we'd need to support it there? (I can tell we'll need<br>
> commands to iterate projects and targets... any others needed?)<br>
<br>
</div>I think just a way to get a list of projects and of targets in a project<br>
wouldn't be enough.<br>
I would need<br>
* get the list of projects (easy)<br>
* I must be able to check whether project A is contained in project B<br>
* I need the targets per project (easy)<br>
* I need to figure out the dependencies between the projects/the contained<br>
targets. I'm not sure I want to do that in cmake script.<br>
<br>
or I need a way to get the projects a project depends on (or the targets a<br>
project depends on and then figure out in cmake-script to which projects<br>
these targets belong :-/)<br>
<br>
My feeling is that figuring out the dependencies should be done in C++.<br>
<br>
Alex<br><br></blockquote></div><br>One thing to consider is what information is available at configure time (CMakeLists.txt processing time).<br><br>The following is allowed:<br><br>CMakeLists.txt:<br><br><div style="margin-left: 40px; font-family: courier new,monospace;">

add_subdirectory(dir1)<br>add_subdirectory(dir2)<br></div>

<br>dir1/CMakeLists.txt<br><br><div style="margin-left: 40px; font-family: courier new,monospace;">add_executable(dir1exe file1.cpp)<br>target_link_libraries(dir1exe dir2lib)<br></div><br>dir2/CMakeLists.txt<br><br><div style="margin-left: 40px; font-family: courier new,monospace;">

add_library(dir2lib file2.cpp)<br></div><br>If you needed to make a decision about dir1exe in dir1/CMakeLists.txt chain of dependencies, you would have incomplete information, because dir2/CMakeLists.txt hasn't been processed yet.  Now if you only need the first level of dependencies it could work.<br>

<br>James<br>