[CMake] How to have a target depend on an External Project

Allen D Byrne byrn at hdfgroup.org
Wed Jan 12 14:09:36 EST 2011


While Marcus states what is likely the preferred way, I just added an ADD_DEPENDENCIES(internal_target external_target) statement that seems to always work?

Allen

> Date: Wed, 12 Jan 2011 13:23:52 -0500
> From: "Marcus D. Hanwell" <marcus.hanwell at kitware.com>
> Subject: Re: [CMake] How to have a target depend on an External
>         Project
> To: kent williams <nkwmailinglists at gmail.com>
> Cc: CMake ML <cmake at cmake.org>
> Message-ID:
>         <AANLkTinDoc6guEnK7rxQ=0yy+sXacOium52iX8ZiHmcz at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> On Wed, Jan 12, 2011 at 12:53 PM, kent williams
> <nkwmailinglists at gmail.com> wrote:
> > For better or worse (mostly better) we are now heavy users of
> > ExternalProject. ?That module works really well to pull in external
> > dependencies and get them built.
> >
> > ExternalProject_add has a DEPENDS keyword that lets you specify
> > dependencies on other External Projects. ?But an ExternalProject isn't
> > an actual CMake target, so I can't figure out how to make a regular
> > CMake target depend on an External Project.
> >
> > Suggestions?
> 
> Don't mix external projects and real targets. An external project
> dependency is different to a target dependency. When expressing
> external project dependencies you are stating that this external
> project needs these others to be built before it is even configured.
> 
> With regular targets there is an assumption that the dependency is
> part of the current build, and so CMake knows everything about it, or
> it was already built. If you have Qt in an external project, and a Qt
> based application depending on it, the find_package(Qt4) will fail
> during initial configure, as there is no Qt built/installed.
> 
> Instead you would normally have your own project as an external
> project that depends on the others it requires to build. That way,
> when your external project is configured the others will have been
> built and therefore could be found.
> 
> I hope that makes the mechanism a little clearer. You could take a
> look at the Titan project as one example where we have many external
> projects that we build, and the Libraries/Applications external
> projects that depend upon them and use them.
> 
> Marcus
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110112/93b56f9e/attachment.htm>


More information about the CMake mailing list