So add_dependencies should work for you. Let us know if it's not working like you think it should...
On Wed, Jan 12, 2011 at 3:48 PM, kent williams <[email protected]>wrote: > Ironically the reason I want to make a target depend on an external > project is that our top level project is already built as an > ExternalProject for all the reasons that have been mentioned. > > I need a custom target to depend on THAT external project, just in the > sense that I want it to be built only after my MAIN project is built. > There's no chicken V egg problems -- my custom target is independent > from that target at configure time. It just needs to happen after that > ExternalProject is built successfully. > > > On Wed, Jan 12, 2011 at 1:12 PM, David Cole <[email protected]> > wrote: > > add_dependencies does work to make sure that ExternalProject targets > build > > before internal targets, if you need that. > > But, like Marcus said, you probably need the ExternalProject to be > > configured and built before your own calls to find_package... so if you > have > > that chicken and egg problem, you should also build your project as an > > ExternalProject. > > Almost all of the projects I know of that are using ExternalProject are > > producing a so-called "SuperBuild" of themselves, wherein all the targets > of > > the SuperBuild are ExternalProject_Add calls, and the last one is the > > "project of interest." > > > > HTH, > > David > > > > On Wed, Jan 12, 2011 at 2:09 PM, Allen D Byrne <[email protected]> > wrote: > >> > >> 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" <[email protected]> > >> > >> > Subject: Re: [CMake] How to have a target depend on an External > >> > >> > Project > >> > >> > To: kent williams <[email protected]> > >> > >> > Cc: CMake ML <[email protected]> > >> > >> > Message-ID: > >> > >> > > >> > <[email protected]<0yy%[email protected]> > > > >> > >> > Content-Type: text/plain; charset=ISO-8859-1 > >> > >> > > >> > >> > On Wed, Jan 12, 2011 at 12:53 PM, kent williams > >> > >> > <[email protected]> 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 > >> > >> > > >> > >> _______________________________________________ > >> 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 > > > > > > _______________________________________________ > > 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 > > > _______________________________________________ > 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 >
_______________________________________________ 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
