[CMake] Runpath issues on OSX 10.6

Michael Wild themiwi at gmail.com
Wed Jun 29 14:49:23 EDT 2011


On 06/29/2011 08:27 PM, Quanah Gibson-Mount wrote:
> I've managed to get cmake to correctly build mysql on Linux OSes, but I
> have a continued problem with mysql on OSX.  Specifically, cmake does
> not install the mysql libraries with the correct RUNPATH settings.
> 
> For example, prior to installing to the destination path:
> 
> sh-3.2# otool -L libmysqlclient.18.dylib
> libmysqlclient.18.dylib:
> 
> /Users/build/p4/main/ThirdParty/mysql/mysql-5.5.13/libmysql/libmysqlclient.18.dylib
> (compatibility version 18.0.0, current version 18.0.0)
> 
> After installation:
> sh-3.2# cd /opt/zimbra/mysql-standard-5.5.13-apple-darwin10-i386/lib/
> sh-3.2# otool -L libmysqlclient.18.dylib
> libmysqlclient.18.dylib:
>        libmysqlclient.18.dylib (compatibility version 18.0.0, current
> version 18.0.0)
> 
> This causes problems when linking to the library later on with other
> software.
> 
> I've attempted to fix this by adding various options to the
> CMakeLists.txt file:
> 
> SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
> SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
> SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
> SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
> LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
> "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
> IF("${isSystemDir}" STREQUAL "-1")
>   SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
> ENDIF("${isSystemDir}" STREQUAL "-1")
> 
> 
> However, no luck in resolving this problem.
> 
> Any help much appreciated!
> 
> --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


That's because on OS X you have to use the INSTALL_NAME_DIR property (or
alternatively, the CMAKE_INSTALL_NAME_DIR variable).

Michael


More information about the CMake mailing list