From e3115479423efb1d864021fa30e5d454f02ae1ea Mon Sep 17 00:00:00 2001
From: Vsevolod Stakhov <vsevolod@highsecure.ru>
Date: Sat, 22 Jul 2017 12:37:59 +0100
Subject: [Minor] Further fixes for torch RPATH

---
 contrib/torch/torch7/cmake/TorchPackage.cmake   |  2 +-
 contrib/torch/torch7/cmake/TorchPathsInit.cmake | 19 -------------------
 2 files changed, 1 insertion(+), 20 deletions(-)

(limited to 'contrib')

diff --git a/contrib/torch/torch7/cmake/TorchPackage.cmake b/contrib/torch/torch7/cmake/TorchPackage.cmake
index 83af751ab..241dd195b 100644
--- a/contrib/torch/torch7/cmake/TorchPackage.cmake
+++ b/contrib/torch/torch7/cmake/TorchPackage.cmake
@@ -25,7 +25,7 @@ MACRO(ADD_TORCH_PACKAGE package src luasrc)
  # As per CMake doc, macro arguments are not variables, so simple test syntax not working
   IF(NOT "${src}" STREQUAL "")
 
-    ADD_TORCH_LIBRARY(${package} MODULE "${src}")
+    ADD_TORCH_LIBRARY(${package} SHARED "${src}")
 
     ### Torch packages supposes libraries prefix is "lib"
     SET_TARGET_PROPERTIES(${package} PROPERTIES
diff --git a/contrib/torch/torch7/cmake/TorchPathsInit.cmake b/contrib/torch/torch7/cmake/TorchPathsInit.cmake
index 2b59c4a0c..42f8ffb3f 100644
--- a/contrib/torch/torch7/cmake/TorchPathsInit.cmake
+++ b/contrib/torch/torch7/cmake/TorchPathsInit.cmake
@@ -17,25 +17,6 @@ FILE(RELATIVE_PATH Torch_INSTALL_CMAKE_RIDBUS "${Torch_INSTALL_CMAKE}" "${Torch_
 GET_FILENAME_COMPONENT(Torch_INSTALL_BIN_RIDBUS "${Torch_INSTALL_BIN_RIDBUS}" PATH)
 GET_FILENAME_COMPONENT(Torch_INSTALL_CMAKE_RIDBUS "${Torch_INSTALL_CMAKE_RIDBUS}" PATH)
 
-IF(UNIX)
-  OPTION(WITH_RPATH "Build libraries with executable rpaths" ON)
-
-  IF(WITH_RPATH)
-    SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
-    FILE(RELATIVE_PATH Torch_INSTALL_BIN2LIB
-      "${Torch_INSTALL_BIN}" "${Torch_INSTALL_LIB}")
-    IF(APPLE)
-      SET(CMAKE_MACOSX_RPATH TRUE) # @rpath in libs
-      SET(CMAKE_INSTALL_RPATH "@executable_path/${Torch_INSTALL_BIN2LIB}") # exec
-    ELSE()
-      SET(CMAKE_INSTALL_RPATH "\$ORIGIN/${Torch_INSTALL_BIN2LIB}")
-    ENDIF()
-  ELSE()
-    SET(CMAKE_MACOSX_RPATH FALSE) # no @rpath in libs
-  ENDIF()
-
-ENDIF(UNIX)
-
 IF (WIN32)
   SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
   SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
-- 
cgit v1.2.3