[CMake] Weirdness with shared library, RPATH policy on MacOS

Michael Wild themiwi at gmail.com
Sat Aug 14 10:31:11 EDT 2010


On 14. Aug, 2010, at 15:13 , Chris Wolf wrote:

> 
> 
> On 8/14/10 3:35 AM, Michael Wild wrote:
>> 
>> On 13. Aug, 2010, at 20:58 , Michael Wild wrote:
>> [...]
>>> 
>>> Sure, http://repo.or.cz/w/freefoam.git/shortlog/refs/heads/pu, but it's pretty complex...
>>> 
>>> Michael
>> 
>> Attached is a tiny project which works for me on both Linux and Mac.
>> 
>> Michael
>> 
> 
> That's awesome! Thanks so much.  From your example, and looking at the documentation:
> http://www.cmake.org/Wiki/CMake_RPATH_handling#Always_full_RPATH
> 
> ...I can see the difference now - you are setting CMAKE_INSTALL_NAME_DIR. 
> (which is not needed or used on Linux/ELF)
> 
> What I had been trying to do along these lines was a per-target setting:
> 
> set_target_properties(usbDynamic PROPERTIES INSTALL_NAME_DIR "/tmp/local/lib")
> 
> -=or=-
> 
> set_target_properties(usbDynamic PROPERTIES INSTALL_RPATH "/tmp/local/lib/libusb-1.dylib"")
> 
> -=or=-
> 
> set_target_properties(usbDynamic PROPERTIES
>   INSTALL_RPATH "/tmp/local/lib/libusb-1.dylib"
>   INSTALL_NAME_DIR "/tmp/local/lib")
> 
> None of those were working for me.
> 
> I will incorporate your setting in my project.
> 
> Thanks,
> 
>   -Chris


Aaaah, I see. The INSTALL_RPATH should have been /tmp/local/lib. And RPATH is only a Linux thing, while install_name is a Mac OS X thing ;-)

Michael


More information about the CMake mailing list