Hi,
System: Ubuntu 18.04, x86_64
CMake version: 3.16.0
Compiler: GCC 7.5
I have the following interface target definition:
set(APP_CYBERRT_PREFIX "/usr/local/cyberRT")
if(EXISTS "${MY_ROOT}/install/cyberRT/bin/mainboard")
set(APP_CYBERRT_PREFIX "${MY_ROOT}/install/cyberRT")
endif()
message(STATUS "app/common: APP_CYBERRT_PREFIX: ${APP_CYBERRT_PREFIX}")
add_library(app_common_cyberrt INTERFACE)
add_library(app::common::cyberrt ALIAS app_common_cyberrt)
target_include_directories(app_common_cyberrt SYSTEM INTERFACE
${APP_CYBERRT_PREFIX}/include /usr/local/fast-rtps/include)
target_link_directories(app_common_cyberrt INTERFACE
${APP_CYBERRT_PREFIX}/lib /usr/local/fast-rtps/lib)
target_link_libraries(app_common_cyberrt INTERFACE
cyber_class_loader cyber_proto cyber_init cyber_node cyber_component
cyber_transport cyber_scheduler cyber_blocker _cyber_timer _cyber_time
cyber cyber_logger fastrtps fastcdr uuid)
Originally, the cyberRT
is put at /usr/local/cyberRT
, libraries stay under /usr/local/cyberRT/lib
, with the option set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
, an installed binary gets the following entries in its RPATH:
/usr/local/fast-rtps/lib
/usr/local/cyberRT/lib
And the executable can run without setting LD_LIBRARY_PATH
.
Today I move the /usr/local/cyberRT
package to some where like /my/root/install/cyberRT
, the build is OK, executable inside build directory has also correct RPATH
setting, it runs without problem.
But after installation, the installed executable has only /usr/local/fast-rtps/lib
in its RPATH
, not /my/root/install/cyberRT/lib
, so the binary is not directly executable.
Now I have to explicitly apend those link directories to CMAKE_INSTALL_RPATH
:
list(APPEND CMAKE_INSTALL_RPATH $<TARGET_PROPERTY:app::common::cyberrt,INTERFACE_LINK_DIRECTORIES>)
Is this intended bahavior? Or is it a bug?
Thanks.