On Monday, April 11, 2011 01:49:21 pm John R. Cary wrote:
> Scenario:
> 
> A library libA.dylib is found somewhere in the building of
> executable B.  Doing the typical link, otool -L shows that B
> references:
> 
>    libA.dylib
> 
> or possibly
> 
>    /A/prefix/lib/libA.dylib.
> 
> I want B to run from either the build directory or the
> installation directory, which I want to be portable.
> 
> A possible solution is to have libA.dylib encoded into B as:
> 
>    @rpath/libA.dylib
> 
> and then to put  @loader_path/ and /A/installdir/lib
> into the rpath of B, and finally to install libA.dylib
> alongside B.
> 
> What is the best way to get this done using CMake?
> 
> What other approaches are there to this basic problem?
> 
> Thx.....John Cary


You could do something like this in your CMakeLists.txt file.
IF(APPLE)
  SET(CMAKE_INSTALL_NAME_DIR @executable_path)
  SET(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
ENDIF(APPLE)

Or use BundleUtilities script when you create an install.

-- 
Clinton Stimpson
Elemental Technologies, Inc
Computational Simulation Software, LLC
www.csimsoft.com
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to