[CMake] Problem linking dynamic libraries on MacOSX

Frank Stappers f.p.m.stappers at tue.nl
Thu Apr 8 03:30:47 EDT 2010


Thanks, for the pointers. I'm able to solve the problem by using the
BundleUtilities.

KR,
Frank

On Wed, Apr 7, 2010 at 2:03 PM, Mike Jackson
<mike.jackson at bluequartz.net> wrote:
> People have been known to use symlinks to solve the problem. There is
> the BundleUtilities that help package the .app part. I wrote some
> cmake code to do basically what you ate wanting to do. It is a
> variation on the BundleUtilities code but works with an executable
> outside of an .app bundle with libraries residing in another folder.
>
> -----
> Mike Jackson                      www.bluequartz.net
> Principal Software Engineer       mike.jackson at bluequartz.net
> BlueQuartz Software               Dayton, Ohio
>
>
> On Apr 7, 2010, at 6:40, Frank Stappers <f.p.m.stappers at tue.nl> wrote:
>
>> Hello,
>>
>> Currently, I have a problem with linking to dynlib outside a bundle.
>> Let me explain: We have a toolset that contains both unix-tools
>> (applications without the .app suffix)
>> and bundles (applications that have the .app suffix). After
>> installation, tools are installed in "./bin"
>> and shared libraries are installed in "./lib/mcrl2".
>>
>> We set the following parameters, for linking:
>>
>> set(CMAKE_SKIP_BUILD_RPATH false)
>> set(CMAKE_BUILD_WITH_INSTALL_RPATH false)
>> set(CMAKE_INSTALL_NAME_DIR "@executable_path/../lib/mcrl2")
>> set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true)
>>
>> This allows for unix-tools to find the relatively located libraries
>> at runtime.
>> However, running a bundle causes a problem. It tries to find the
>> libraries relative to the
>> executable which is @executable_path/../lib/mcrl2/lib_XXX.dylib in the
>> /Contents/MacOS,
>> instead of the path relative to the bundle, which should be
>> @executable_path/../../../lib/mcrl2/lib_XXX.dylib.
>>
>> Perhaps, somebody has some pointers on how to tackle this problem.
>> Any help is welcome.
>>
>> Kind regards,
>> Frank Stappers
>> _______________________________________________
>> 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
>


More information about the CMake mailing list