ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

It looks like this is the default behavior for CMake, and has very little to do with ROS or the bloom packaging process: https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling .

In particular, it looks like the Always full RPATH section will do what you're asking for:

# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH  FALSE)

# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)


# the RPATH to be used when installing, but only if it's not a system directory
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")

P.S. - The gpio library you're using looks dangerous; it's opening /dev/mem and reading and writing hardware addresses: https://github.com/UbiquityRobotics/pi_sonar/blob/2f853b264a0252bbc1b5cba13b4872d7009241dc/pigpio/pigpio.c#L7180-L7275 . On any processor other than the intended target, this may result in a bus error in your program, or memory corruption in any part of the kernel or another program. This may cause an immediate crash, or may not be noticeable for quite some time after the corruption occurs. Be warned that you're playing with the software equivalent of fire and live explosives.