summaryrefslogtreecommitdiff
path: root/torch/CMakeLists.txt
diff options
context:
space:
mode:
authorJesse Hellemn <hellemn@fb.com>2018-11-26 15:55:40 -0800
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2018-11-26 15:57:47 -0800
commitafb2c0ce8660b7c79892f6532403753114bf34d0 (patch)
treeba4265b5dd6e2163d3b213bc350c5ef615413b81 /torch/CMakeLists.txt
parentb18063b39a891f195f22348104d3b9f6d176a7e8 (diff)
downloadpytorch-afb2c0ce8660b7c79892f6532403753114bf34d0.tar.gz
pytorch-afb2c0ce8660b7c79892f6532403753114bf34d0.tar.bz2
pytorch-afb2c0ce8660b7c79892f6532403753114bf34d0.zip
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
Diffstat (limited to 'torch/CMakeLists.txt')
-rw-r--r--torch/CMakeLists.txt12
1 files changed, 5 insertions, 7 deletions
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})