[CMake] still having rpath problems on osxZ
Boudewijn Rempt
boud at valdyas.org
Thu Dec 31 03:41:00 EST 2015
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
More information about the CMake
mailing list