<div dir="ltr"><div>Hi John,<br><br></div>the primary tool for superbuilds in CMake&#39;s arsenal is ExternalProject_Add from module ExternalProject. I don&#39;t have much experience with it, but you can read its docs to see if it could help you.<br>
<br>Petr<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 18, 2013 at 5:38 AM, John Gallagher <span dir="ltr">&lt;<a href="mailto:johnkgallagher+cmake@gmail.com" target="_blank">johnkgallagher+cmake@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello all,<div><br></div><div>Some Googling has led me to questions that have been asked that are similar to this one but I haven&#39;t seen a definitive answer. I&#39;m trying to set up a CMake &quot;superbuild&quot; where there are dependencies between the subprojects, and some of the subprojects use find_package() to import targets from their dependencies (other subprojects, from the superbuild&#39;s point of view). For a stripped down example, suppose I have proj1 and proj2. proj1 can be built and installed on its own, and it writes out a Proj1Config.cmake file (with targets and such). proj2 uses</div>

<div><br></div><div>find_package(Proj1 REQUIRED)</div><div><br></div><div>to import those targets. So independent of a CMake superbuild, things work just fine if I configure, build, and install proj1, *then* configure, build, and install proj2. Is there a way to do this using a CMake superbuild? Some ideas (mostly gleaned from the aforementioned googling):</div>

<div><br></div><div>1. Use add_subdirectory() from the superproject. I think the REQUIRED on find_package() would fail though? In my case I can modify the subprojects, but I would like for them to continue to build correctly standalone (not inside the superbuild), as they really are separate projects. Is there a way to make add_subdirectory() work without exploding on find_package?</div>

<div><br></div><div>2. Don&#39;t use CMake for the &quot;superbuild&quot; - a shell script or plain Makefile could accomplish this pretty easily, but that seems a little hokey.</div><div><br></div><div>
3. (This one is unclear.) Somehow build proj1 before configuring proj2, and point proj2 at proj1&#39;s build directory so it can find Proj1Config.cmake. This seems fragile at best (prefix, RPATH, etc issues).</div><div>
<br></div><div>Appreciate any advice!</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>John</div></font></span></div>
<br>--<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></div>