[CMake] padding link arguments to the linker

Brad King brad.king at kitware.com
Wed Feb 8 09:47:41 EST 2006


mike jackson wrote:
> I am building the official VTK 5.x release on OS X and I would like to
> add a custom link argument for all the generated libraries. I am
> building dynamic libraries and I would like to set the "install-name"
> of each library to "@executable_path/../Plugins" so I can include the
> libs in my .app package. Normally I would set this in the Xcode build
> settings but since I am using cmake I have no idea where to set that.
> 
> The link argument would normally be something like "-install_name
> @executable_path/../Plugins/libvtkCommon.dylib"

The VTK CMake code provides an interface to allow some customization of 
the build.  Create a file Common/LocalUserOptions.cmake in either the 
VTK build tree or the source tree.  Add this line:

SET_TARGET_PROPERTIES(vtkCommon PROPERTIES LINK_FLAGS
  "-install_name @executable_path/../Plugins/libvtkCommon.dylib")

Re-run CMake on the build tree and then build again.  The vtkCommon 
library should be linked with this option.  Then do the same for the 
other kits.

-Brad


More information about the CMake mailing list