<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 4, 2011, at 4:24 PM, Clifford Yapp wrote:</div><br><blockquote type="cite"><div class="gmail_quote">On Tue, Oct 4, 2011 at 7:20 AM, Daniel Dekkers <span dir="ltr"><<a href="mailto:d.dekkers@cthrough.nl">d.dekkers@cthrough.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">
Hi,<br>
<br>
Would really appreciate your advice on this.<br>
<br>
We are planning to use and maybe distribute a library (let's call it OurLib) that depends on third-party libraries, namely Boost, Glut, OpenGL, FreeType, Bullet, PNG, ...<br></blockquote></div><br>You could take a look at what BRL-CAD does for this situation:<br>
<br><a href="http://brlcad.svn.sourceforge.net/viewvc/brlcad/brlcad/trunk">http://brlcad.svn.sourceforge.net/viewvc/brlcad/brlcad/trunk</a> (look for adding the src/other subdirectory in CMakeLists.txt)<br><a href="http://brlcad.svn.sourceforge.net/viewvc/brlcad/brlcad/trunk/src/other/">http://brlcad.svn.sourceforge.net/viewvc/brlcad/brlcad/trunk/src/other/</a><br>
<br>macros used are defined in:<br><br><a href="http://brlcad.svn.sourceforge.net/viewvc/brlcad/brlcad/trunk/misc/CMake/">http://brlcad.svn.sourceforge.net/viewvc/brlcad/brlcad/trunk/misc/CMake/</a><br></blockquote><div><br></div>Ok, thanks, will take a look.</div><div><br><blockquote type="cite">From a high level, our approach is to try to detect suitable installations of libraries on the system. If we find them, use them. If not, build our local copy. </blockquote><div><br></div><div>Ok. </div><div>For me, in a perfect world, I would like to be able to do this for a top level CMakeLists.txt...</div><div><br></div><div>project(all)</div><div>add_subdirectory(lib0)</div><div>add_subdirectory(lib1)</div><div>...</div><div>add_subdirectory(app0)</div><div>add_subdirectory(app1)</div><div><br></div><div>... if I want to see and manipulate the sources of these libraries.</div><div>And if i don't, just use the binaries...</div><div><br></div><div>project(all)</div><div>find_package(lib0 ...)</div><div>find_package(lib1 ...)</div><div>...</div><div>add_directory(app0)</div><div>add_directory(app1)</div><div><br></div><div>And be "free" in that. So i could also do a local build of an individual library and just link directly to that binary.</div><br><blockquote type="cite">Currently our approach requires that each third-party library also have a functional CMake build, </blockquote><div><br></div><div>Yes. Most libraries we use have that, or are at least getting there. We've "investigated" somewhere around 8-10 libraries as of now. I get the impression that library developers are willing to provide a CMake build, probably because it helps them too, internally. But often the find_package(), is lacking. The library developers don't feel responsible for the find[Package].cmake script, they don't see it anyway because (of course) they are mostly looking at the source code of their own library. So,... Kitware, or someone else will write it instead, but only as a reaction to the latest version of the library, which might have changed in the meantime (which is the case with Bullet at this moment, for instance). So some libraries (like OpenSceneGraph) just provide their own long list of find[Package].cmake scripts, and redirect with set(CMAKE_MODULE_PATH ...) which (i think) is a pity, because everybody wants these scripts, shipped with the official CMake distribution. But I realize that this is a lot of work, because you have to communicate with all the individual library developers.</div><div><br></div><blockquote type="cite">but in principle you could try adding support for other systems with ExternalProject_Add as well. We found it simpler to just write CMake logic where needed, since in theory we need all of our third-party deps to build in every situation </blockquote><div><br></div><div>Yes</div><br><blockquote type="cite">BRL-CAD itself needs to build in - rather than worry about whether the third-party library has enough build systems defined to cover all those cases (and figuring out how to trigger which one when) it proved simpler to write the CMake logic for the library. Eventually, we'd like to have upstream adopt the CMake logic and we could just use their source archives unaltered, but we're a ways away from that and some projects are pretty heavily invested in Autotools.<br></blockquote><div><br></div>Ok</div><div><br><blockquote type="cite">
Cheers,<br>CY<br>
</blockquote><br></div><div>Thanks,</div><div>Daniel Dekkers</div><br></body></html>