[CMake] How to set Install_name on OS X

Mike Jackson mike.jackson at imts.us
Tue Oct 10 17:01:12 EDT 2006




On 10/10/06 4:56 PM, "Brad King" <brad.king at kitware.com> wrote:

> Mike Jackson wrote:
>> On 10/10/06 4:08 PM, "Brad King" <brad.king at kitware.com> wrote:
>>> cmake --help-command SET_TARGET_PROPERTIES
>> 
>> OK.. Reading all the output from that command there seems to be some
>> mutually exclusive settings. Also, the output has settings like
>> INSTALL_NAME_DIR, should those be CMAKE_INSTALL_NAME_DIR instead?
>> 
>> I tried the following in my Cmake file and it just is not working.
>> 
>> # ------- Create a Shared Library ---------------------------------
>> ADD_LIBRARY(DislocationIO SHARED ${SOURCES} )
>> 
>> #---------- Link the Library  ---------------------------------
>> TARGET_LINK_LIBRARIES(DislocationIO
>>   ${vtkLocal_LIBS}
>> )
>> SET_TARGET_PROPERTIES (DislocationIO
>> PROPERTIES BUILD_WITH_INSTALL_RPATH ON
>>            CMAKE_INSTALL_NAME_DIR "@executable_path/../PlugIns"
>>            )
>> 
>> I don't mean to be difficult, but could you lend me a bit more help? I have
>> tried a few different versions of the above all with out success.
> 
> The property is called INSTALL_NAME_DIR.  The variable
> CMAKE_INSTALL_NAME_DIR is used to initialize the value of the property
> on the ADD_LIBRARY line.  Try this:
> 
> SET_TARGET_PROPERTIES (DislocationIO
>   PROPERTIES BUILD_WITH_INSTALL_RPATH 1
>              INSTALL_NAME_DIR "@executable_path/../PlugIns"
>   )
> 
> If you leave off the BUILD_WITH_INSTALL_RPATH property then it will not
> be built with this install_name but when you run "make install" the
> installed copy of the library will get the proper value.
> 
> -Brad

Nope, that didn't work either. I tried "installing" DislocationIO to see if
it would relink but that didn't work either...

-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services






More information about the CMake mailing list