[CMake] When should I use add_subdirectory and when ExternalProject?

Jean-Christophe Fillion-Robin jchris.fillionr at kitware.com
Tue Feb 5 13:22:56 EST 2013


Hi Alex,

You could probably pass the CMAKE_INSTALL_PREFIX option.
For example:
https://github.com/Slicer/Slicer/blob/master/SuperBuild/External_DCMTK.cmake#L44

Hth
Jc


On Tue, Feb 5, 2013 at 1:10 PM, Alexander Neundorf
<a.neundorf-work at gmx.net>wrote:

> On Monday 04 February 2013, David Cole wrote:
> > The OpenChemistry project (
> https://github.com/OpenChemistry/openchemistry
> > ) is a very good example of a SuperBuild project that builds all of its
> > external dependencies via ExternalProject, and then all of its git
> > submodules ("internal dependencies" perhaps ?) also via ExternalProject.
> >
> > They use CMAKE_PREFIX_PATH both as a place to install all of the built
> > components, and as a place for find_package to find stuff that was built
> > by a previous ExternalProject_Add call.
> >
> > Study how they do stuff in their CMakeLists files and then get back to us
> > here with more questions.
>
> one thing I had trouble with is related to the install step.
>
> With externalProject the install step happens at build time.
> If shared libraries are involved, the install destination should be the
> correct and final install destination, so that the RPATH of using projects
> will point to the correct location.
> This means that at build time I need to have the permissions to write to
> the
> final install destination (e.g. /opt/), i.e. typically root.
>
> Is this correct or am I missing something ?
>
> Alex
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
+1 919 869 8849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130205/601d84b9/attachment.htm>


More information about the CMake mailing list