[Insight-developers] Any way to make/fake subdirectories depending on ExternalProject?

Brad King brad.king at kitware.com
Thu Jan 20 15:38:02 EST 2011


On 01/20/2011 03:19 PM, Williams, Norman K 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?

Make all the wrapper targets depend on the external project target
using add_dependencies().

-Brad


More information about the Insight-developers mailing list