[CMake] Installing projects built with ExternalProject_Add

Ben Morgan bmorgan.warwick at gmail.com
Wed Oct 27 07:52:04 EDT 2010


Hi,

I'm working on a project which depends on several external projects (mostly
non-CMake), so naturally I've been taking a look at using ExternalProject
to
build these prerequisites. I've got a simple "superproject" working that
just
builds one of these external projects using ExternalProject_Add and that
works
nicely, building and installing the project (a library plus headers) into a
directory under the build directory of the superproject.


What I haven't been able to work out is if there's a good way, or if it's
even
good practice, to install the libraries, headers and applications built
under
ExternalProject_Add as part of the install of the superproject. The idea
here
is to provide a (semi) complete solution for an end user so they don't have
to
install and set up all the dependencies by hand (many of the packages are
scientific software, so not commonly available pre-packaged).

So far, my test superproject uses the install command with the DIRECTORY
signature to install the contents of the external_project INSTALL_DIR
to a location under the CMAKE_INSTALL_PREFIX for the superproject. That
works,
but if parts of the external project are prefix-aware, some paths in
scripts
are not correct in the "superinstall" as they point to somewhere under the
build directory of the superproject.

I think I might be able to fix this by setting prefixes of the external
projects to their final superinstall location, missing out the install step
in
ExternalProject_Add and then using install(CODE ...) to somehow hook into
the
actual install command of the external project.

That seems possible, but I wanted to check that I'm not over-reaching the
purpose of ExternalProject_Add, or implementing bad practice with regard to
installing dependencies! Or is there a better way to do this installation
with
ExternalProject_Add?


The other option I can think of is converting all the external projects to
CMake as VTK and Paraview do(?) for things like libxml2? That's clearly
more
work, but would it be a cleaner solution overall since everything would be
under the CMake umbrella?


Best Regards,

Ben Morgan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101027/96feecf3/attachment.htm>


More information about the CMake mailing list