[CMake] Relative paths for MacOSX shared libraries

Brad King brad.king at kitware.com
Wed Oct 26 11:21:30 EDT 2005


David Flitney wrote:
> I've been having some trouble getting shared libraries to build with the 
> correct paths installed. I want to build, for example, VTK libraries 
> which I can place in the Frameworks directory of a MacOS .app bundle. 
> I've been told that previously one could set CMAKE_SHARED_LINKER_FLAGS 
> to be: "-install_name @executable_path/../Frameworks/`basename 
> <TARGET>`" and <TARGET> would get replaced by the relevant soname in 
> each generated Makefile. However this isn't working for me using 
> up-to-date versions of CMake(2.3-20051006) and VTK(5.1 as of early 
> October) etc. The generated build.make files simply contain an 
> unexpanded <TARGET> string. Has this behaviour been deprecated? Does 
> anyone know how to achieve this?

The <> style replacement does not work in *_FLAGS variables, only in 
build rule variables.  Look in Modules/Platform/Darwin.cmake at the 
settings of the variables CMAKE_C_CREATE_SHARED_LIBRARY and 
CMAKE_CXX_CREATE_SHARED_LIBRARY.  You can set these variables to build 
your libraries however you like.

-Brad


More information about the CMake mailing list