Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 24, 2011, 5:48:53 AM (14 years ago)
Author:
rgrieder
Message:

RPATH handling was broken in certain cases, esp. for "turn-key" (INSTALL_COPYABLE) installations.
Fixed by using the "$ORIGIN" token and distinguishing between executable, library and module when setting the RPATH.

Location:
code/branches/kicklib2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/kicklib2/cmake/InstallConfig.cmake

    r8317 r8318  
    7171################## Unix rpath ###################
    7272
     73# Use, i.e. don't skip the full RPATH for the build tree
     74SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
     75
    7376# When building, don't use the install RPATH already
    7477# (but later on when installing)
     
    7780# The RPATH to be used when installing
    7881IF(INSTALL_COPYABLE)
    79   SET(CMAKE_INSTALL_RPATH ${DEFAULT_LIBRARY_PATH})
     82  # Get relative paths from run to lib and from module to lib directory.
     83  FILE(RELATIVE_PATH _runtime_rpath "/${RUNTIME_INSTALL_DIRECTORY}" "/${LIBRARY_INSTALL_DIRECTORY}")
     84  FILE(RELATIVE_PATH _module_rpath  "/${MODULE_INSTALL_DIRECTORY}" "/${LIBRARY_INSTALL_DIRECTORY}")
     85  # $ORIGIN (with $ escaped) refers to the actual location of the library
     86  # The UNIX loader recognises this special variable
     87  SET(RUNTIME_RPATH "\$ORIGIN/${_runtime_rpath}")
     88  SET(LIBRARY_RPATH "\$ORIGIN")
     89  SET(MODULE_RPATH  "\$ORIGIN:\$ORIGIN/${_module_rpath}")
    8090ELSE()
    81   SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIRECTORY})
     91  SET(RUNTIME_RPATH "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIRECTORY}")
     92  SET(LIBRARY_RPATH "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIRECTORY}")
     93  SET(MODULE_RPATH  "${LIBRARY_RPATH}:${CMAKE_INSTALL_PREFIX}/${MODULE_INSTALL_DIRECTORY}")
    8294ENDIF()
    8395
  • code/branches/kicklib2/cmake/tools/TargetUtilities.cmake

    r8317 r8318  
    288288
    289289  # RPATH settings for the installation
    290   IF(UNIX)
    291     SET(_rpath ${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIRECTORY})
     290  IF(_target_type STREQUAL "LIBRARY")
    292291    IF(_arg_MODULE)
    293       LIST(APPEND _rpath ${CMAKE_INSTALL_PREFIX}/${MODULE_INSTALL_DIRECTORY})
    294     ENDIF()
    295     SET_TARGET_PROPERTIES(${_target_name} PROPERTIES INSTALL_RPATH "${_rpath}")
    296   ENDIF()
     292      SET(_rpath "${MODULE_RPATH}")
     293    ELSE()
     294      SET(_rpath "${LIBRARY_RPATH}")
     295    ENDIF()
     296  ELSE()
     297    SET(_rpath "${RUNTIME_RPATH}")
     298  ENDIF()
     299  SET_TARGET_PROPERTIES(${_target_name} PROPERTIES INSTALL_RPATH "${_rpath}")
    297300
    298301  # DEFINE_SYMBOL
  • code/branches/kicklib2/src/OrxonoxConfig.cmake

    r8285 r8318  
    2727
    2828#################### Options ####################
    29 
    30 # Use, i.e. don't skip the full RPATH for the build tree
    31 SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
    3229
    3330# Global switch to disable Precompiled Header Files
Note: See TracChangeset for help on using the changeset viewer.