# HG changeset patch # User koda # Date 1388262263 -3600 # Node ID 891eb7fcc26c43241a3ccf3236d3458a09599ab5 # Parent 6c4dbe67fd7dce631b47f93084d89c3fbfc57659 correctly handle @rpath diff -r 6c4dbe67fd7d -r 891eb7fcc26c cmake_modules/paths.cmake --- a/cmake_modules/paths.cmake Fri Dec 27 01:25:03 2013 +0400 +++ b/cmake_modules/paths.cmake Sat Dec 28 21:24:23 2013 +0100 @@ -55,13 +55,22 @@ #which point to directories outside the build tree to the install RPATH set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) -#paths where to find libraries (final slash not optional): -# - the first is relative to the executable -# - the second is the same directory of the executable (so it runs in bin/) -# - the third one is the full path of the system dir -#source http://www.cmake.org/pipermail/cmake/2008-January/019290.html -set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/") - +if(APPLE) + set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks") + #workaround older cmake versions + if(${CMAKE_VERSION} VERSION_LESS "2.8.12") + add_flag_append(CMAKE_C_LINK_FLAGS "-Wl,-rpath -Wl,${CMAKE_INSTALL_RPATH}") + add_flag_append(CMAKE_CXX_LINK_FLAGS "-Wl,-rpath -Wl,${CMAKE_INSTALL_RPATH}") + add_flag_append(CMAKE_Pascal_LINK_FLAGS "-k-rpath -k${CMAKE_INSTALL_RPATH}") + endif() +else(APPLE) + #paths where to find libraries (final slash not optional): + # - the first is relative to the executable + # - the second is the same directory of the executable (so it runs in bin/) + # - the third one is the full path of the system dir + #source http://www.cmake.org/pipermail/cmake/2008-January/019290.html + set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/") +endif(APPLE) #install_name_tool magic for OS X set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Frameworks")