[CMake] Problem linking dynamic libraries on MacOSX
Frank Stappers
f.p.m.stappers at tue.nl
Wed Apr 7 06:40:53 EDT 2010
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
More information about the CMake
mailing list