[CMake] Can imported libraries depend on ExternalProject targets?

Alexander Neundorf a.neundorf-work at gmx.net
Mon Jun 25 17:24:31 EDT 2012


On Saturday 23 June 2012, Stefan Reuschl wrote:
> Am 22.06.2012, 20:21 Uhr, schrieb Kent Williams
> 
> <nkwmailinglists at gmail.com>:
> > OK, I guess.
> > 
> > The only reason I bring this up is ITK. If you're familiar with the
> > ITK build process, it has a 'module' concept -- not a module in the
> > CMake sense (where it is a library intended for runtime loading), but
> > in the sense that the build process is modular.  Each of the ITK
> > libraries is a module, which is defined by a standardised directory
> > layout and cmake files.
> > 
> > I made an Module for DCMTK that satisfies the requirements of an ITK
> > module -- it builds DCMTK as an External Project, and uses
> > add_library(name <lib-type> IMPORTED) on each of the libraries DCMTK
> > creates, and connects the imported library with the actual library
> > file in the file system.
> > 
> > This all works fine EXCEPT for this one conundrum, you can't have the
> > imported libraries depend on the ExternalProject target, so if you
> > want to make sure the ExternalProject gets built before the targets
> > that try to link to them, you have to make the executable (or library)
> > target depend on the ExternalProject target to serialize the build of
> > the dependee before the depnder.
> 
> The following once worked fine for me using CMake 2.8.8:
> 
> ExternalProject_Add( ep )
> add_library( epLib IMPORTED )
> set_target_properties( epLib PROPERTIES IMPORTED_LOCATION ... )
> add_dependencies( epLib ep )


Yes, that's what I use too, and it works fine for me, at least if you know 
what you are doing.

Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120625/1b1cac7f/attachment.htm>


More information about the CMake mailing list