[CMake] Runpath issues on OSX 10.6

Michael Wild themiwi at gmail.com
Wed Jun 29 15:27:51 EDT 2011


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:

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...

HTH

Michael


More information about the CMake mailing list