[vtk-developers] Exporting CMake Targets with VTK-6 Dependencies
Cyrus Harrison
cyrush at llnl.gov
Thu Oct 24 14:48:53 EDT 2013
Hi Brad,
Thanks for clarifying.
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.
With EXPORT() AND INSTALL(EXPORT), does each target need to be
explicitly named?
-Cyrus
On 10/23/13 10:11 AM, "Brad King" <brad.king at kitware.com> wrote:
>On 10/23/2013 11:29 AM, Cyrus Harrison wrote:
>> I am trying to export target dependencies for a target using VTK-6 into
>> another CMake project using EXPORT_LIBRARY_DEPENDENCIES, basically:
>
>The export_library_dependencies command should never be used in new
>code for any reason. In fact CMake 3.0 will introduce a CMake Policy
>that will complain about calls to the command. The only reason the
>command still exists is to support old code.
>
>> This works in most other CMake contexts -- the problem is, with VTK-6
>>the
>> VTK libs have the suffix "-6.0".{so,dylib} and the resulting deps file
>> (and CMakeCache entries in VTK_LIBRARIES) seems to leave off the "-6.0",
>> probably due to special CMake rules provided by VTK.
>> The only exceptions are the built-in third-party libs (such as
>> libvtkjpeg-6.0) which are fine.
>
>This is a known limitation of export_library_dependencies and is one
>reason it was replaced by install(EXPORT).
>
>> I understand INSTALL(EXPORT) is preferred to
>>EXPORT_LIBRARY_DEPENDENCIES,
>> but the generated file in that case appears to have the same issue.
>
>The dependencies are expressed between imported library targets by
>their logical name, but each has an IMPORTED_LOCATION property set
>to the proper file name with the -6.0 suffix. You just need to make
>sure that VTK's are imported along with yours.
>
>> Can anyone point me in the right direction to accomplish this?
>
>See the tutorials here:
>
> http://www.cmake.org/Wiki/CMake/Tutorials#CMake_Packages
>
>If you're writing a project that does find_package(VTK), links to
>VTK_LIBRARIES in your own targets, and then install(EXPORT)s them,
>then in your <package>Config.cmake file that loads the targets
>file produced by install(EXPORT)s you need to find_package(VTK)
>too in order to get VTK's imported targets to satisfy dependencies.
>
>-Brad
More information about the vtk-developers
mailing list