[CMake] Runpath issues on OSX 10.6

Quanah Gibson-Mount quanah at zimbra.com
Wed Jun 29 15:33:27 EDT 2011


--On Wednesday, June 29, 2011 9:27 PM +0200 Michael Wild 
<themiwi at gmail.com> wrote:

> On 06/29/2011 09:14 PM, Quanah Gibson-Mount wrote:
>> --On Wednesday, June 29, 2011 8:49 PM +0200 Michael Wild
>> <themiwi at gmail.com> wrote:
>>
>>> That's because on OS X you have to use the INSTALL_NAME_DIR property (or
>>> alternatively, the CMAKE_INSTALL_NAME_DIR variable).
>>
>> I put:
>>
>> IF(APPLE)
>>  SET(INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
>> ENDIF()
>>
>> in CMakeLists.txt, and the result is the same.  I tried
>> CMAKE_INSTALL_NAME_DIR as well, same result.  So this does not appear to
>> resolve the issue. :/
>>
>> --Quanah
>
> The variable is called CMAKE_INSTALL_NAME_DIR. The property must be set
> using set_target_properties(). Also, remove all the other RPATH related
> stuff, to avoid strange interactions. You might also want to create a
> tiny test project for your experiments. E.g. something like this:

As noted above, I tried both the variable names.  In fact, I have now even 
stripped out the "APPLE" if:

SET(INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
SET(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")

I don't see either of these set in CMakeCache.txt after cmake is run.

> cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
> project(test)
> set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
> add_library(test SHARED test.c)
> install(TARGETS test
>   RUNTIME DESTINATION lib
>   LIBRARY DESTINATION lib)
>
> where the test.c file contains a trivial function, e.g.
>
> void foo(void){}
>
>
> Unfortunately I currently don't have access to OS X, so I wasn't able to
> test the above...

Unfortunately, all I have is the massive behemoth of mysql.  I'm not really 
sure how to translate your example above into their sprawling build bits. 
:/  I will try again with all the RPATH pieces pulled as well.

--Quanah

--

Quanah Gibson-Mount
Sr. Member of Technical Staff
Zimbra, Inc
A Division of VMware, Inc.
--------------------
Zimbra ::  the leader in open source messaging and collaboration


More information about the CMake mailing list