I think I've finally figured out why I didn't get the results the cmake 
documentation suggested I should be getting... It's the extra-cmake-modules 
that I use, Krita being a KDE application. With these settings:

    set(KDE_SKIP_RPATH_SETTINGS 1)
    set(CMAKE_MACOSX_RPATH 1)
    set(BUILD_WITH_INSTALL_RPATH 1)

My libraries are built with an @rpath id, instead of an absolute path id. Now 
only the executable needs to have its rpath set correctly after install and 
after making a bundle, and all libraries are found and all plugins find the 
libraries, too.

Without KDE_SKIP_RPATH_SETTINGS, everything gets set to full, absolute paths on 
doing a make install. That might make sense on Linux, I guess... But no wonder 
that I was confused all the time.

So, to check that I really understand it:

On OSX, every library has an id. That id can be 
/abs/o/lute/path/to/library.dylib or library.dylib or @rpath/library.dylib.

The exectutable has a bunch of paths where it can look for libraries, and the 
path + library.dylib has to match the library id.

so, if the executable has

@path = ../lib;../Frameworks

and links to

@path/library.dylib

and a library with that id is in ../lib (or ../Frameworks) from the 
executable's location, everything will be fine.

Which makes it easiest for me, I guess to have @rpath in the id for every 
library, and on make install set the exectables' rpath to where I install the 
libraries to, and on creating the bundle update the rpaths in the executable to 
the Frameworks folder. The only thing that won't work is running unittests 
without installing, but that's not a big problem, for me...

--
Boudewijn Rempt | http://www.krita.org, http://www.valdyas.org
--

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to