[CMake] Adding dylib with either @rpath or absolute paths to osx cmd line executable target

Bart Nabbe bana at cs.cmu.edu
Fri Feb 15 21:57:35 EST 2013


Hi,

I'm sure I just overlooked something, but I can not get shared libraries (at a non system location) to load properly at runtime after having had them linked properly.
If I run otool -L the library is listed without any path or loader reference:
dylibLinkTest:
	libiomp5.dylib (compatibility version 5.0.0, current version 5.0.0)
	libtbb.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)


I can use the install_name_tool to change these to @rpath/libiomp5.dylib and @rpath/libtbb.dylib respectively and all is well (I set rpath with a linker option in my CMakeLists.txt). From searching I did learn about the BundleUtilities, but I'm not quite sure how I would use it or if it would really be suitable to solve the problem.

Any suggestions would be greatly appreciated.


Thanks,

Bart



More information about the CMake mailing list