<div dir="ltr"><div><div>I finally got this working, including the sources from both projects and simultaneous building. It was simpler than I thought, and as similar to how you originally suggested. I created a superbuild CMakeLists.txt which just contains the add_subdirectory(libs) and add_subdirectory(apps). I reference the include directories for the libs headers by setting cache variable in the libs/CMakeLists.txt, which are then referenced in the apps/CMakeLists.txt . Since it's all together the targets from libs can be directly referenced when linking in apps.<br>
</div><div><br></div>I'm not finished, but this method is already slick and straight forward. Our previous build system was based on plain makefiles with lots of edge cases, hardlinking, and referencing msvc7.0 via msys commandline flags (I know...). <br>
<br></div>Thanks VERY much for cmake, our last build system was horrendous. I'm glad Sandia sponsors this.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Sep 20, 2013 at 12:45 PM, Aaron Nowack <span dir="ltr"><<a href="mailto:aaronbnowack@gmail.com" target="_blank">aaronbnowack@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"><div class="im"><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
You can structure the app CMakeLists such that it can reference the libs
as part of a big "build everything" tree like this, or as something
that has to be found with find_package, or as something you just point
to with CMake variables.</blockquote></div><div class="gmail_extra"><br>Was the "parent" CMakeLists.txt an example of only how to combine the
sources, or should it be reasonably possible to do step-building? For example, I attempted the following...<br><br></div><div class="gmail_extra">I've setup a "parent" CMakeLists.txt for the apps and libs as you described with subdirectories for apps and libs. I build the libs first, and have it set a variable of where the library will be installed to, named apps_lib_path. apps_lib_path is set with PARENT_SCOPE so it is passed into the apps/ directory. <br>
<br>Now, in the apps folder I must reference to the library that libs will build. This seems to create a chicken-egg issue as I am trying to reference a library that isn't yet created. I am using find_package(libs) which checks several possible locations for the library, the first being apps_lib_path for the library libApps. Since no libApps is present (hasn't been built yet, still in the cmake stage) it is set to NOTFOUND and cmake returns an error.</div>
<div class="im">
<div class="gmail_extra"><br></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div class="gmail_extra">The best approach I've seen for this sort of thing so far is being used
in the Open Cheimstry projects. They build and install everything as
part of a "super build" into a known installation prefix in the "super
build" build tree. Then, they use CMAKE_PREFIX_PATH and find_package to
find *previously* built/installed sub-projects in subsequent
sub-projects. Everything is built via ExternalProject there, but none of
the individual projects build anything with ExternalProject -- they
find everything with find_package. ( See their repos here: <a href="https://github.com/OpenChemistry" target="_blank">https://github.com/OpenChemistry</a> -- the super build is in: <a href="https://github.com/OpenChemistry/openchemistry" target="_blank">https://github.com/OpenChemistry/openchemistry</a> )</div>
</blockquote><div><br></div></div><div>This is a great example, so they install into a common place where each project can use find_project(other_project) and link correctly. They force incremental rebuilds by using ExternalProject_Add_Step.<br>
<br></div><div>Thanks for the help,<br></div><div>- Aaron<br></div><div><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 18, 2013 at 8:51 AM, David Cole <span dir="ltr"><<a href="mailto:dlrdave@aol.com" target="_blank">dlrdave@aol.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Ideally, for these rapid co-development phases I would like to<br>
a) Be able to rebuild a project using ExternalProject_Add<br>
whenever any source file changes.<br>
</blockquote>
<br></div>
ExternalProject is not well suited for handling source level changes.<div><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
b) Provide the mechanism for an IDE project to include all<br>
the sources from another project specified by<br>
ExternalProject_Add.<br>
</blockquote>
<br></div>
Because of my answer for "(a)", I still don't think it's a good idea.<div><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
For b) there was a bug open and closed here,<br>
<a href="http://www.cmake.org/Bug/view.php?id=12322" target="_blank">http://www.cmake.org/Bug/view.<u></u>php?id=12322</a><br>
<br>
I understand David's point about making bad assumptions, but I would<br>
find it extremely useful if I was able to include the sources and <br>
</blockquote>
force a<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
rebuild as I'm describing.<br>
</blockquote>
<br></div>
I understand, and many others would also find it useful, but I doubt it can be done reliably. If somebody would like to prove me wrong, (on Windows with all supported versions of Visual Studio, and on the Mac with all versions of Xcode, and with Eclipse, and ...), I will gladly reverse my opinion.<div>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Does anyone have any ideas? We're currently doing a lot of <br>
</blockquote>
refactoring on<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
both repositories so removing as much development overhead will really<br>
help. When things get stable we will be using ExternalProject_Add on<br>
tagged revisions.<br>
</blockquote>
<br></div>
The best solution for rapid co-development of multiple repositories is NOT to use ExternalProject. ExternalProject, as recently discussed in another mailing list thread here, is best suited for building static snapshots of repositories that do not change frequently.<br>
<br>
Does everything build with CMake? Good. Then you can make something like this work:<br>
<br>
# CMakeLists.txt<br>
cmake_minimum_required(VERSION 2.8.11)<br>
project(GlueLibsAndApp)<br>
add_subdirectory(libs)<br>
add_subdirectory(app)<br>
<br>
# Then, checkout the two separate repositories in "libs" and "app" and boom: all your sources for everything are all in the generated IDE project<br>
<br>
You can structure the app CMakeLists such that it can reference the libs as part of a big "build everything" tree like this, or as something that has to be found with find_package, or as something you just point to with CMake variables.<br>
<br>
Then later on, you can create a super build that builds both libs and app separately using ExternalProject, and have that app refer to the libs built in that manner, rather than as targets in the same CMakeLists directory structure.<br>
<br>
<br>
The best approach I've seen for this sort of thing so far is being used in the Open Cheimstry projects. They build and install everything as part of a "super build" into a known installation prefix in the "super build" build tree. Then, they use CMAKE_PREFIX_PATH and find_package to find *previously* built/installed sub-projects in subsequent sub-projects. Everything is built via ExternalProject there, but none of the individual projects build anything with ExternalProject -- they find everything with find_package. ( See their repos here: <a href="https://github.com/OpenChemistry" target="_blank">https://github.com/<u></u>OpenChemistry</a> -- the super build is in: <a href="https://github.com/OpenChemistry/openchemistry" target="_blank">https://github.com/<u></u>OpenChemistry/openchemistry</a> )<br>
<br>
<br>
HTH,<br>
David<br>
<br>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>