[CMake] How to set Install_name on OS X

Mike Jackson mike.jackson at imts.us
Tue Oct 10 16:49:45 EDT 2006


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

> Mike Jackson wrote:
>> I am attempting to set the "install_name" on OS X for Shared Libraries but
>> the solution that I _thought_ would work does not because somewhere in cmake
>> the linker flag "-install_name" is _already_ defined and so adding another
>> one just confuses the linker.
>>   Is there some way I can hack a .cmake file to expose and set the value for
>> "-install_name"
>> 
>> I need this because I need the install path to point to
>> "@executable_path/../Frameworks" or "@executable_path/../PlugIns" and not
>> some directory somewhere?
>> 
>> Or is there a command line argument I can pass to Make to over-ride what is
>> in the makefile?
> 
> cmake --help-command SET_TARGET_PROPERTIES
> 
> -Brad


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.

On a side note, I _can_ do this with an external shell script using
"install_name_tool" but is very tedious to do it this way and very error
prone.

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






More information about the CMake mailing list