[cmake-developers] rpaths on Mac
Brad King
brad.king at kitware.com
Mon Nov 21 15:55:07 EST 2011
On 11/21/2011 3:41 PM, James Bigler wrote:
> Would what you are proposing make the following easier? This is how I setup @rpath on my system.
>
> Why do you need something special? I use @rpath for the install name by doing the following:
>
> if(RELEASE_PUBLIC)
> set_target_properties( my_target PROPERTIES
> INSTALL_NAME_DIR "@rpath"
> BUILD_WITH_INSTALL_RPATH ON
> )
> endif()
>
> Then I do the following for my executables:
>
> if( RELEASE_INSTALL_BINARY_SAMPLES )
> target_link_libraries( ${target_name}
> -Wl,-rpath, at executable_path/.
> -Wl,-rpath, at executable_path/../../lib
> )
> elseif( RELEASE_PUBLIC)
> target_link_libraries( ${target_name}
> -Wl,-rpath, at executable_path/../lib
> )
> endif()
CMake supports RPATH naturally on other platforms but that implementation
predated RPATH support on OS X. Now we want to activate it to work the
same on OS X as on other platforms, but in a compatible and sensible way.
My proposal to switch off INSTALL_NAME_DIR==@rpath would actually break
your example, so perhaps we need another way to switch on the behavior.
-Brad
More information about the cmake-developers
mailing list