From ca35c7afb2362c914456211df11d78e9f68688c5 Mon Sep 17 00:00:00 2001 From: YuSheng Date: Tue, 30 Apr 2019 01:09:40 +0800 Subject: [PATCH] add RPATH for compiled tools to find the libddsc.so (#153) * add RPATH for compiled tools to find the libddsc.so Signed-off-by: YuSheng --- src/CMakeLists.txt | 5 +++++ src/tools/pubsub/CMakeLists.txt | 1 + 2 files changed, 6 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e56d494..d1539dd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -154,6 +154,11 @@ endif() include(GNUInstallDirs) include(AnalyzeBuild) +if(APPLE) + set(CMAKE_INSTALL_RPATH "@loader_path/../${CMAKE_INSTALL_LIBDIR}") +else() + set(CMAKE_INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}") +endif() # Include Coverage before CTest so that COVERAGE_COMMAND can be modified # in the Coverage module should that ever be necessary. include(Coverage) diff --git a/src/tools/pubsub/CMakeLists.txt b/src/tools/pubsub/CMakeLists.txt index f7244c7..62a9494 100644 --- a/src/tools/pubsub/CMakeLists.txt +++ b/src/tools/pubsub/CMakeLists.txt @@ -11,6 +11,7 @@ # add_executable(pubsub pubsub.c common.c testtype.c porting.c) target_link_libraries(pubsub ddsc) + if(WIN32) target_compile_definitions(pubsub PRIVATE _CRT_SECURE_NO_WARNINGS) endif()