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

Chris Wolf cw10025 at gmail.com
Sat Aug 14 09:13:46 EDT 2010



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



More information about the CMake mailing list