Skip to content

Commit 6304ac6

Browse files
committed
cmake: Work around CUDA 8 overriding OpenCL path
Fix #804.
1 parent ec0d5bf commit 6304ac6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,16 @@ IF(ENABLE_CUDA)
378378
ENDIF()
379379
ENDIF(ENABLE_CUDA)
380380

381+
# RPATH handling for CUDA 8.0 libOpenCL.so conflict. See #804.
382+
IF(HAVE_OpenCL EQUAL yes AND UNIX AND NOT APPLE)
383+
FILE(GLOB CUDA_ld_so_conf /etc/ld.so.conf.d/cuda*.conf)
384+
IF(CUDA_ld_so_conf)
385+
MESSAGE(WARNING "Your CUDA installation overrides OpenCL system library path.")
386+
GET_FILENAME_COMPONENT(OpenCL_LIB_PATH ${OpenCL_LIBRARY} DIRECTORY)
387+
SET(CMAKE_INSTALL_RPATH ${OpenCL_LIB_PATH} CACHE STRING "Set RPATH for system OpenCL")
388+
ENDIF()
389+
ENDIF()
390+
381391
# RPATH handling for private libusb copies
382392
# Users have two options:
383393
# 1. Build libusb in depends/ and leave it there:

0 commit comments

Comments
 (0)