From afb2c0ce8660b7c79892f6532403753114bf34d0 Mon Sep 17 00:00:00 2001 From: Jesse Hellemn Date: Mon, 26 Nov 2018 15:55:40 -0800 Subject: changing some rpath stuff (#14304) Summary: See if anything breaks Pull Request resolved: https://github.com/pytorch/pytorch/pull/14304 Differential Revision: D13201418 Pulled By: pjh5 fbshipit-source-id: ac2101b61a23bda37329d4d923c3d9d120e718bf --- torch/CMakeLists.txt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'torch/CMakeLists.txt') diff --git a/torch/CMakeLists.txt b/torch/CMakeLists.txt index 0683e9da63..cce58b2061 100644 --- a/torch/CMakeLists.txt +++ b/torch/CMakeLists.txt @@ -29,9 +29,12 @@ endif() # RPATH stuff # see https://cmake.org/Wiki/CMake_RPATH_handling -if(APPLE) +if (APPLE) set(CMAKE_MACOSX_RPATH ON) -endif() + set(_rpath_portable_origin "@loader_path") +else() + set(_rpath_portable_origin $ORIGIN) +endif(APPLE) # Use separate rpaths during build and install phases set(CMAKE_SKIP_BUILD_RPATH FALSE) # Don't use the install-rpath during the build phase @@ -40,11 +43,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) # Automatically add all linked folders that are NOT in the build directory to # the rpath (per library?) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -# Always ensure that CMAKE_INSTALL_PREFIX/lib is in the rpath -list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) -if("${isSystemDir}" STREQUAL "-1") - list(APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") -endif() # Get the correct Python executable if (DEFINED ENV{PYTORCH_PYTHON}) -- cgit v1.2.3