summaryrefslogtreecommitdiffstats
path: root/Modules/FindCUDA.cmake
diff options
context:
space:
mode:
authorJames Bigler <jbigler@nvidia.com>2010-01-28 18:50:38 (GMT)
committerJames Bigler <jbigler@nvidia.com>2010-01-28 18:50:38 (GMT)
commitaa495ad021a922bd3959f0eecb97d5e95c89e617 (patch)
tree4853ff351a39a8d19d96eb3046a010ef9ca4ee7c /Modules/FindCUDA.cmake
parentf04f91269458f538846ce0fafcc95469e4436ffd (diff)
downloadCMake-aa495ad021a922bd3959f0eecb97d5e95c89e617.zip
CMake-aa495ad021a922bd3959f0eecb97d5e95c89e617.tar.gz
CMake-aa495ad021a922bd3959f0eecb97d5e95c89e617.tar.bz2
Add -rpath for cuda libraries on Apple. They use @rpath in the library link names.
Diffstat (limited to 'Modules/FindCUDA.cmake')
-rw-r--r--Modules/FindCUDA.cmake8
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 2c60cfc..6539057 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -546,6 +546,14 @@ endmacro()
# CUDA_LIBRARIES
find_library_local_first(CUDA_CUDART_LIBRARY cudart "\"cudart\" library")
set(CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY})
+if(APPLE)
+ # We need to add the path to cudart to the linker using rpath, since the
+ # library name for the cuda libraries is prepended with @rpath.
+ get_filename_component(_cuda_path_to_cudart "${CUDA_CUDART_LIBRARY}" PATH)
+ if(_cuda_path_to_cudart)
+ list(APPEND CUDA_LIBRARIES -Wl,-rpath "-Wl,${_cuda_path_to_cudart}")
+ endif()
+endif()
# 1.1 toolkit on linux doesn't appear to have a separate library on
# some platforms.