[CMake] Any way to make/fake subdirectories depending on ExternalProject?

Bill Hoffman bill.hoffman at kitware.com
Thu Jan 20 15:25:34 EST 2011


On 1/20/2011 3:19 PM, kent williams wrote:
> I kinda know the simple answer is 'no.'  I hope there's a creative
> *couch*sneaky*cough* way to do this.
>
> I'm trying to build CableSwig as a external project as part of ITK.  I
> have this working for a single-process build.  It works in that case
> because the ExternalProject_add happens textually before all the
> add_subdirectory clauses at the bottom of ITK's top level
> CMakeLists.txt file.
>
> If you run a parallel build, CableSwig gets downloaded and built in
> parallel with subdirectories that need CableSwig to build, so the
> compile fails, obviously.
>
> The problem is that subdirectories aren't targets, and can't depend on
> CableSwig.  What I need is a trick to fake out CMake such that it
> guarantees the CableSwig subproject get built completely before moving
> on into subdirectories.
>
> Any ideas?  Or am I just abusing the very spirit of CMake?

You are abusing the spirit of external project.  To do this you would 
want to create one project that has two external projects:

CableSwig
ITK

Then you can have ITK depend on CableSwig.  You really can not mix 
external project with regular targets that expect that stuff to be built 
first.

-Bill


More information about the CMake mailing list