<div dir="ltr">The real world example is Slicer -- <a href="http://www.slicer.org/pages/DeveloperOrientation">http://www.slicer.org/pages/DeveloperOrientation</a><div><br></div><div style>This is rather a large and complex project and the way they do somethings is hard to decode.</div>
<div style><br></div><div style>Make sure you read through and understand this: </div><div style><br></div><div style><a href="http://www.kitware.com/media/html/BuildingExternalProjectsWithCMake2.8.html">http://www.kitware.com/media/html/BuildingExternalProjectsWithCMake2.8.html</a></div>
<div style><br></div><div style>The simplest setup is this:</div><div style><br></div><div style>Add a directory SuperBuild to your project.</div><div style><br></div><div style>Within SuperBuild, write a CMakeLists.txt that contains ExternalProject_add for each of the prerequisite libraries.</div>
<div style><br></div><div style>Then use an ExternalProject to configure and build your actual project. Since SuperBuild is a subdirectory of your actual project, there's no need to download source, so you suppress the download and update steps, and specify where to find the source.</div>
<div style><br></div><div style>ExternalProject_Add(MyProject</div><div style> DEPENDS ${Prerequisite_List} # this is the list of all the prerequisite ExternalProjects you've added.</div><div style> DOWNLOAD_COMMAND "" # no need to download</div>
<div style> UPDATE_COMMAND "" # or update.</div><div style> SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/.. # source is relative to where this CMakeLists.txt is</div><div style> BINARY_DIR MyProject-build # otherwise build is nested down in MyProject-prefix</div>
<div style> CMAKE_ARGS ${MyProject_CMAKE_ARGS} # set to allow your project to find prerequisites</div><div style> # e.g. -DITK_DIR:PATH=${PATH_TO_ITK_BUILD}</div>
<div style>)</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Feb 4, 2013 at 9:23 AM, Ansis Māliņš <span dir="ltr"><<a href="mailto:ansis.malins@gmail.com" target="_blank">ansis.malins@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">><span style="font-family:arial,sans-serif;font-size:13px">SuperBuild pattern</span><div><span style="font-family:arial,sans-serif;font-size:13px">Tell me all about it!</span></div>
</div>
</blockquote></div><br></div>