From 27d46969716010ed39571f2074b6c18c7a7f8623 Mon Sep 17 00:00:00 2001 From: casey langen Date: Thu, 1 Feb 2018 19:12:28 -0800 Subject: [PATCH] Fix RPATH handling in CMakeLists.txt --- CMakeLists.txt | 7 +++++++ src/musikcubed/CMakeLists.txt | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e68eb0ae1..88867112e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,6 +67,13 @@ include_directories ( "${musikcube_SOURCE_DIR}/src/3rdparty/include" "${musikcube_SOURCE_DIR}/src/plugins/taglib_plugin/taglib-1.11/stage/include") +# ensure the binaries can find libmusikcore.so, which lives in the +# same directory. +if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") + set(CMAKE_INSTALL_RPATH "$ORIGIN") + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) +endif() + # "/usr/local" doesn't seem to be included by default on macOS 10.12+ # "/opt/local" is the default installation location for MacPorts if (CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD") diff --git a/src/musikcubed/CMakeLists.txt b/src/musikcubed/CMakeLists.txt index 2b2e7bd3b..9d75339cd 100644 --- a/src/musikcubed/CMakeLists.txt +++ b/src/musikcubed/CMakeLists.txt @@ -7,10 +7,7 @@ if (NOT DEFINED musikcube_INSTALL_DIR) set(musikcube_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) endif() -configure_file("musikcubed.in" "musikcubed" @ONLY) - add_executable(musikcubed ${DAEMON_SRCS}) -set_target_properties(musikcubed PROPERTIES LINK_FLAGS "-Wl,-rpath,./") if (${LINK_STATICALLY} MATCHES "true") find_library(EVLIB NAMES libev.a ev)