[vtk-developers] Link errors after recent check ins

Brad King brad.king at kitware.com
Mon Aug 6 10:39:26 EDT 2012


On 08/06/2012 10:25 AM, Marcus D. Hanwell wrote:
>> This topic should fix it:
>>
>>  http://review.source.kitware.com/#/t/1022
>>
> The reason I did this was for projects adding VTK as a subdirectory,
> we were hoping that they could be added to the export file. I am not
> clear on why the APPEND mode of export is not as clean (nor did I spot
> anything in the documentation).

It isn't the APPEND mode so much as invoking the command anywhere
except the end.  From the export() command documentation:

 http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:export
 "Do not set properties that affect the location of a target after
  passing it to this command."

The safest way to ensure the properties do not change is to call
export() last.

For projects that have VTK as a subdirectory, do this:

 add_subdirectory(VTK)
 # ...
 get_property(VTK_TARGETS GLOBAL PROPERTY VTK_TARGETS)
 export(TARGETS ${MY_TARGETS} ${VTK_TARGETS}
        FILE ${MY_BINARY_DIR}/MyTargets.cmake)

-Brad



More information about the vtk-developers mailing list