[CMake] MacOS X RPATH
Konstantinos Theofilis
saultigh at fastmail.net
Thu Jul 11 07:21:22 EDT 2013
Hi,
Using the following RPATH commands, my project is working fine on Linux and OS X.
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
Now, I have the need to link to a library that is outside the system paths and has to reside, e.g. at /home/user/foo.
Keeping the above three lines , everything on Linux still works fine. The path to /home/user/foo/libfoo is added to the executable, as it should, because of the
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
line.
But in OS X , while everything links fine and compiles fine, the binaries cannot find the new library, and a quick look with otool reveals that the path was not set for libfoo and I have to manually copy it to the executable's location in order to work.
Any ideas?
Thanks,
Kostas
More information about the CMake
mailing list