[Paraview-developers] Plugin developers: update to target_link_libraries calls in CMake code
Marcus D. Hanwell
marcus.hanwell at kitware.com
Wed Aug 28 13:52:25 EDT 2013
Hi,
We recently merged in some changes to VTK and ParaView that make use
of the new target_link_libraries command signature, these offer much
better control over what is a public interface library and what is a
private link. This is largely dictated by whether the thing being
linked to is exposed in the public headers/API or just used in the
implementation files.
One issue is that target_link_libraries with no arguments defaults to
making all links public, but if it is called on a target with the new
signature then that default changes to private for all previous and
subsequent calls. This is far from ideal, but it is the way it has
been added to CMake and so we must work with it. CMake 2.8.12 will
issue warnings when any target has calls with both signatures.
As a plugin developer you may need to add links to things that were
once public and are now private, such as vtksys, MPI (using
include(vtkMPI) and vtk_mpi_link(target_name)). If you want to retain
the previous behavior for your linking simply changing the call to
include LINK_PUBLIC will work,
target_link_libraries(my_plugin LINK_PUBLIC my_interface_libs
LINK_PRIVATE vtksys)
would add my_interface_libs to the public links for the target, and
vtksys to the private links. In VTK/ParaView this allows us to reduce
the length of link lines, and to reduce the number of include
directories in the search paths (can be removed for any non-public
dependencies of the module's dependencies).
We will be working to remove more libraries from the public interface
libraries going forward, and so further adjustments may be necessary.
Please ask if anything wasn't clear, inserting LINK_PUBLIC into your
calls to link libraries is all that is necessary to maintain the
previous behavior. It may be necessary to add some dependencies
explicitly that were once implicitly brought in.
Thanks,
Marcus
More information about the Paraview-developers
mailing list