[CMake] ExternalProject_Add examples

Pau Garcia i Quiles pgquiles at elpauer.org
Sun Oct 27 17:40:22 EDT 2013


Hello,

ExternalProject_Add(A
...
)

ExternalProject_Add(B
DEPENDS A
...)

ExternalProject_Add(C
DEPENDS B
...
)

CMake will take care of the build order of those projects

Please check winstng for a complex project with a lot of interdependencies.
The documentation for ExternalProject and this article by David Cole also
help a lot:

http://www.kitware.com/media/html/BuildingExternalProjectsWithCMake2.8.html




On Sun, Oct 27, 2013 at 10:31 PM, Witold E Wolski <wewolski at gmail.com>wrote:

> Dear Kent,
>
> Thank you for pointing me to this project.
> I did some searching for an explanation of the superbuild cmake
> pattern but didn't find any text resources.
>
> I am wondering if the superbuild pattern can cover the following case:
>
> I.e. given 3 projects A, B and C where B depends on A and C depends on
> B ... that means B will not build without A... and C not without B.
> Is this covered by the superbuild pattern for C? Or asked differently
> how can the superbuild of C control the build of B so that B finds the
> product of A?
>
> I guess this is controlled by the order how the external projects are
> added. Right? In which file is this done in the NamiceExternalProject?
>
> Furthermore, What happens if B is an Superbuild patter project already?
>
>
>
> regards
> Witold
>
>
>
> On 25 October 2013 17:18, Williams, Norman K
> <norman-k-williams at uiowa.edu> wrote:
> > There is our project here:
> > https://github.com/BRAINSia/NAMICExternalProjects
> >
> > This is set up using the CMake 'SuperBuild' pattern first used with
> Slicer.
> >
> > It might be more complicated a setup than you have in mind, but it builds
> > a large number of interdependent packages.
> >
> > It's structured as a two-phase setup:  First, all prerequisite packages
> > are built, and then the actual project is built.  As
> NamicExternalProjects
> > is set up as a functioning prototype, the 'top-level' CMake project is
> > empty.
> >
> > Adding a new external project is a matter of copying
> > SuperBuild/External_Template.cmake to
> > SuperBuild/External_<your_project>.cmake and editing it to make it
> > specific to that project. This mostly amounts to  setting its
> > dependencies, where to download the source from, and which version to
> > download.
> >
> > --
> > Kent Williams norman-k-williams at uiowa.edu
> >
> >
> >
> >
> >
> >
> > On 10/24/13 3:35 AM, "Witold E Wolski" <wewolski at gmail.com> wrote:
> >
> >>Would also like to start configuring external dependencies with
> >>
> >>ExternalProject_Add
> >>
> >>So some examples would be pretty useful to me. So did you ended up
> >>collecting some examples?
> >>Sure, you posted in this links to repositories, but finding the
> >>"ExternalProject_Add" in these huge projects with hundreds of
> >>CMakeLists.txt is not easy if they are not in the top-level
> >>CMakeLists.txt and they are not there.
> >>
> >>My dependencies are
> >>
> >>gtest - Cmake
> >>glog - Cmake
> >>tbb - configure make
> >>vigra - Cmkae based
> >>soci - Cmake based
> >>pwiz
> >>
> >>
> >>regards
> >>
> >>
> >>
> >>On 18 March 2012 00:24, Luigi Calori <l.calori at cineca.it> wrote:
> >>> On 17/03/2012 22.11, Marcus D. Hanwell wrote:
> >>>>
> >>>> On Sat, Mar 17, 2012 at 5:03 PM, Bill Lorensen<
> bill.lorensen at gmail.com>
> >>>> wrote:
> >>>>>
> >>>>> Folks,
> >>>>>
> >>>>> I've recently created a number of super builds using CMake's External
> >>>>> Project mechanism. Each external project requires some sort of
> >>>>> download, configuration, build and possibly install. The CMake
> defines
> >>>>> needed to correctly access the results of the external project vary
> >>>>> significantly. The trickiest part is find the proper download,
> >>>>> configuration and CMake defines.
> >>>>>
> >>>>> For example, for the Point Cloud Library (http://pointclouds.org/) I
> >>>>> created these external projects:
> >>>>> VTK - git, cmake, make; VTK_DIR
> >>>>> FLANN - zip, cmake, make install; FLANN_LIBRARY, FLANN_INCUDE_DIR
> >>>>> Eigen - .tar.bz2,; EIGEN_INCLUDE_DIR
> >>>>> Qhull - git, cmake, make;QHULL_LIBRARY,QHULL_INCLUDE_DIR
> >>>>> Boost - .tar.gz, bootstrap.sh, b2; BOOST_ROOT
> >>>>> GTest - .zip, cmake, make; GTEST_ROOT,GTEST_INCLUDE_DIR
> >>>>>
> >>>>> Slicer4 has many more.
> >>>>>
> >>>>> Should we start collecting sample ExternalProject_Add files for
> >>>>> external projects?
> >>>>
> >>>> We have talked about doing this too (I have Eigen, Boost, GTest and
> >>>> others for example). The standard CMake based projects hardly seem
> >>>> worth it, but it depends on what you want to do with them I suppose.
> >>>> For the work we are doing in chemistry we have been working on an
> >>>> experimental superbuild that uses a common prefix in the build tree to
> >>>> install to, and then all we need pass in is CMAKE_PREFIX_PATH - this
> >>>> can make the logic significantly easier for dependent CMake projects
> >>>> as it will always search within the prefix first.
> >>>
> >>> I did something similar, trying to collet all the build of stuff that I
> >>>had
> >>> to do in a single place powered by cmake
> >>> Used  CMAKE_PREFIX_PATH and a single source place where all the builds
> >>> download  and expand
> >>>
> >>> you can have a look at
> >>>
> >>> https://hpc-forge.cineca.it/svn/CmakeBuilds/lib/
> >>>
> >>> It's just for my use only, so really dirty and not properly checked, I'
> >>>m
> >>> also looking for good starting point for common stuff like Qt, boost
> and
> >>> others
> >>> (I' tried to collect in the folder  Packages the tricky part of
> building
> >>> the components,) I' ve tried to define a dependency graph but it' still
> >>> messy
> >>>
> >>> anyway I would really appreciate a place where to share good "recipies"
> >>>for
> >>> CMake building packeges
> >>>
> >>> Thanks
> >>>                   Luigi
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>
> >>>> The Qt external project was pretty tricky too, and we are using that
> >>>> in several places along with smaller libraries like libxml2.
> >>>>
> >>>> Marcus
> >>>> --
> >>>>
> >>>> 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
> >>>>
> >>>
> >>>
> >>> --
> >>> Luigi Calori
> >>> SuperComputing Applications and Innovation Department
> >>> CINECA - via Magnanelli, 6/3, 40033 Casalecchio di Reno (Bologna) -
> >>>ITALY
> >>> Tel: +39 051 6171509  Fax: +39 051 6132198
> >>> hpc.cineca.it
> >>>
> >>>
> >>> --
> >>>
> >>> 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
> >>
> >>
> >>
> >>--
> >>Witold Eryk Wolski
> >>--
> >>
> >>Powered by www.kitware.com
> >>
> >>Please keep messages on-topic and check the CMake FAQ at:
> >>http://www.cmake.org/Wiki/CMake_FAQ
> >>
> >>Kitware offers various services to support the CMake community. For more
> >>information on each offering, please visit:
> >>
> >>CMake Support: http://cmake.org/cmake/help/support.html
> >>CMake Consulting: http://cmake.org/cmake/help/consulting.html
> >>CMake Training Courses: http://cmake.org/cmake/help/training.html
> >>
> >>Visit other Kitware open-source projects at
> >>http://www.kitware.com/opensource/opensource.html
> >>
> >>Follow this link to subscribe/unsubscribe:
> >>http://www.cmake.org/mailman/listinfo/cmake
> >
> >
> >
> > ________________________________
> > Notice: This UI Health Care e-mail (including attachments) is covered by
> the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is
> confidential and may be legally privileged.  If you are not the intended
> recipient, you are hereby notified that any retention, dissemination,
> distribution, or copying of this communication is strictly prohibited.
>  Please reply to the sender that you have received the message in error,
> then delete it.  Thank you.
> > ________________________________
> > --
> >
> > Powered by www.kitware.com
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
> >
> > CMake Support: http://cmake.org/cmake/help/support.html
> > CMake Consulting: http://cmake.org/cmake/help/consulting.html
> > CMake Training Courses: http://cmake.org/cmake/help/training.html
> >
> > Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.cmake.org/mailman/listinfo/cmake
>
>
>
> --
> Witold Eryk Wolski
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20131027/7d397b0f/attachment-0001.htm>


More information about the CMake mailing list