summaryrefslogtreecommitdiff
path: root/Tests/Cuda
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-06-21 09:35:16 -0400
committerBrad King <brad.king@kitware.com>2017-06-21 10:41:49 -0400
commitfff782f6a64a64538254b23891dc00b18ecec4fe (patch)
tree3a291de2cc28ce0c66af0e2744ad4ed0bb82722f /Tests/Cuda
parentad4a68cca00af3a20caaafbb96be67a1cc53a027 (diff)
downloadcmake-fff782f6a64a64538254b23891dc00b18ecec4fe.tar.gz
Tests: Simplify CUDA rpath on macOS
Use the `BUILD_RPATH` property and reference the CMake-computed location of the runtime libraries.
Diffstat (limited to 'Tests/Cuda')
-rw-r--r--Tests/Cuda/Complex/CMakeLists.txt5
-rw-r--r--Tests/Cuda/ObjectLibrary/CMakeLists.txt6
-rw-r--r--Tests/Cuda/WithC/CMakeLists.txt5
3 files changed, 7 insertions, 9 deletions
diff --git a/Tests/Cuda/Complex/CMakeLists.txt b/Tests/Cuda/Complex/CMakeLists.txt
index 450ef487cc..a7137e3aea 100644
--- a/Tests/Cuda/Complex/CMakeLists.txt
+++ b/Tests/Cuda/Complex/CMakeLists.txt
@@ -42,7 +42,6 @@ add_executable(CudaComplex main.cpp)
target_link_libraries(CudaComplex PUBLIC CudaComplexMixedLib)
if(APPLE)
- # We need to add the default path to the driver (libcuda.dylib) as an rpath, so that
- # the static cuda runtime can find it at runtime.
- target_link_libraries(CudaComplex PRIVATE -Wl,-rpath,/usr/local/cuda/lib)
+ # Help the static cuda runtime find the driver (libcuda.dyllib) at runtime.
+ set_property(TARGET CudaComplex PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
endif()
diff --git a/Tests/Cuda/ObjectLibrary/CMakeLists.txt b/Tests/Cuda/ObjectLibrary/CMakeLists.txt
index 1d93be7326..276dc92255 100644
--- a/Tests/Cuda/ObjectLibrary/CMakeLists.txt
+++ b/Tests/Cuda/ObjectLibrary/CMakeLists.txt
@@ -10,8 +10,8 @@ add_library(CudaMixedObjectLib OBJECT static.cu static.cpp)
add_executable(CudaObjectLibrary
main.cpp
$<TARGET_OBJECTS:CudaMixedObjectLib>)
+
if(APPLE)
- # We need to add the default path to the driver (libcuda.dylib) as an rpath, so that
- # the static cuda runtime can find it at runtime.
- target_link_libraries(CudaObjectLibrary PRIVATE -Wl,-rpath,/usr/local/cuda/lib)
+ # Help the static cuda runtime find the driver (libcuda.dyllib) at runtime.
+ set_property(TARGET CudaObjectLibrary PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
endif()
diff --git a/Tests/Cuda/WithC/CMakeLists.txt b/Tests/Cuda/WithC/CMakeLists.txt
index 1f25ab43ed..831ce12c9b 100644
--- a/Tests/Cuda/WithC/CMakeLists.txt
+++ b/Tests/Cuda/WithC/CMakeLists.txt
@@ -6,7 +6,6 @@ string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30")
add_executable(CudaWithC main.c cuda.cu)
if(APPLE)
- # We need to add the default path to the driver (libcuda.dylib) as an rpath, so that
- # the static cuda runtime can find it at runtime.
- target_link_libraries(CudaWithC PRIVATE -Wl,-rpath,/usr/local/cuda/lib)
+ # Help the static cuda runtime find the driver (libcuda.dyllib) at runtime.
+ set_property(TARGET CudaWithC PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
endif()