[vtk-developers] Exporting CMake Targets with VTK-6 Dependencies

Brad King brad.king at kitware.com
Thu Oct 24 15:57:53 EDT 2013

On 10/24/2013 02:48 PM, Cyrus Harrison wrote:
> The reason we were using EXPORT_LIBRARY_DEPENDENCIES is that we have we
> have ~130 targets we need to export -- filtered from ~2000. 
> EXPORT_LIBRARY_DEPENDENCIES gave us an easy automatic path to capture 
> all important targets -- in our case filtering the generated file using 
> CMake was quite easy due to the names of the targets we exclude.

You must have install(TARGETS) rules for them, no?

> With EXPORT() AND INSTALL(EXPORT), does each target need to be 
> explicitly named?

Each target needs to be named in export(), but usually projects
collect the list of names in a global property and then look it up
and export() once at the end of the configuration.

In install(EXPORT) one does not actually name targets.  Those go in

 install(TARGETS ... DESTINATION ... EXPORT MyProject)

to associate them with a particular logical installation export
name.  Then install(EXPORT) creates and installs a file that
refers to all the targets.

So you just need to update each install(TARGETS) rule for the
targets to be exported to add the extra "EXPORT ..." and then
do the install(EXPORT) in one place.


More information about the vtk-developers mailing list