From 48a58fb81e3167dd6dafe3133bbdc95cbab97129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietrich=20Kr=C3=B6nke?= Date: Wed, 9 Jun 2021 11:11:39 +0200 Subject: [PATCH] iox-828 Add CMAKE_INSTALL_RPATH to iceoryx_meta If iceoryx is built as shared lib we need to set an rpath to the installed shared libs so that roudi can find them --- iceoryx_meta/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/iceoryx_meta/CMakeLists.txt b/iceoryx_meta/CMakeLists.txt index 726b7db093..f06b7fd06c 100644 --- a/iceoryx_meta/CMakeLists.txt +++ b/iceoryx_meta/CMakeLists.txt @@ -25,6 +25,12 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/build_options.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/tests.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/install_help_and_config.cmake) +# set rpath for finding shared libraries outside of the build-tree +# see https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling#cmake-and-the-rpath +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() # ===== Core add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../iceoryx_utils ${CMAKE_BINARY_DIR}/utils)