48 #source http://www.cmake.org/pipermail/cmake/2008-January/019290.html |
48 #source http://www.cmake.org/pipermail/cmake/2008-January/019290.html |
49 set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/") |
49 set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/") |
50 set(CMAKE_INSTALL_RPATH_ESCAPED "$$ORIGIN/../${target_library_install_dir}/:$$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/") |
50 set(CMAKE_INSTALL_RPATH_ESCAPED "$$ORIGIN/../${target_library_install_dir}/:$$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/") |
51 |
51 |
52 if(UNIX AND NOT APPLE) |
52 if(UNIX AND NOT APPLE) |
53 list(APPEND pascal_flags "-k-rpath" "-k'${CMAKE_INSTALL_RPATH_ESCAPED}'" "-k-z" "-korigin") |
53 #make sure $ORIGIN is respected |
54 list(APPEND haskell_flags "-optl" "-Wl,-rpath,'${CMAKE_INSTALL_RPATH_ESCAPED},-z,origin'") |
54 append_linker_flag("-zorigin") |
55 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,origin") |
55 #apply RPATH settings to pascal and haskell executables |
56 set(CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} -Wl,-z,origin") |
56 list(APPEND pascal_flags "-k-rpath" "-k'${CMAKE_INSTALL_RPATH_ESCAPED}'") |
57 set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -Wl,-z,origin") |
57 list(APPEND haskell_flags "-optl" "-Wl,-rpath,'${CMAKE_INSTALL_RPATH_ESCAPED}'") |
58 endif() |
58 endif() |
59 |
59 |
60 #add the automatically determined parts of the RPATH |
60 #add the automatically determined parts of the RPATH |
61 #which point to directories outside the build tree to the install RPATH |
61 #which point to directories outside the build tree to the install RPATH |
62 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) |
62 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) |