diff options
author | Brad King <brad.king@kitware.com> | 2016-09-20 12:40:42 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-09-20 12:40:42 (GMT) |
commit | 6a9b30aea32e4347c94f1afe6a458ceab88c50c3 (patch) | |
tree | 9593b76f1fd88adceff8b0e5e67a0e9582e5fbfd | |
parent | 83ec894ffd7747e36245615f3332a9bc5bed9ba0 (diff) | |
parent | 891e0ebdcea547b10689eee9fd008a27e4afd3b9 (diff) | |
download | CMake-6a9b30aea32e4347c94f1afe6a458ceab88c50c3.zip CMake-6a9b30aea32e4347c94f1afe6a458ceab88c50c3.tar.gz CMake-6a9b30aea32e4347c94f1afe6a458ceab88c50c3.tar.bz2 |
Merge topic 'cuda_use_cudadevrt_with_separable_compilation'
891e0ebd FindCUDA: find cudadevrt and link it if CUDA_SEPARABLE_COMPILATION is ON
-rw-r--r-- | Modules/FindCUDA.cmake | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index aaa1536..6b76c25 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -303,6 +303,8 @@ # CUDA_ADD_CUBLAS_TO_TARGET macro). # CUDA_cudart_static_LIBRARY -- Statically linkable cuda runtime library. # Only available for CUDA version 5.5+ +# CUDA_cudadevrt_LIBRARY -- Device runtime library. +# Required for separable compilation. # CUDA_cupti_LIBRARY -- CUDA Profiling Tools Interface library. # Only available for CUDA version 4.0+. # CUDA_curand_LIBRARY -- CUDA Random Number Generation library. @@ -564,6 +566,7 @@ macro(cuda_unset_include_and_libraries) unset(CUDA_CUDARTEMU_LIBRARY CACHE) endif() unset(CUDA_cudart_static_LIBRARY CACHE) + unset(CUDA_cudadevrt_LIBRARY CACHE) unset(CUDA_cublas_LIBRARY CACHE) unset(CUDA_cublas_device_LIBRARY CACHE) unset(CUDA_cublasemu_LIBRARY CACHE) @@ -794,6 +797,10 @@ else() set(CUDA_USE_STATIC_CUDA_RUNTIME OFF CACHE INTERNAL "") set(CUDA_CUDART_LIBRARY_VAR CUDA_CUDART_LIBRARY) endif() +if(NOT CUDA_VERSION VERSION_LESS "5.0") + cuda_find_library_local_first(CUDA_cudadevrt_LIBRARY cudadevrt "\"cudadevrt\" library") + mark_as_advanced(CUDA_cudadevrt_LIBRARY) +endif() if(CUDA_USE_STATIC_CUDA_RUNTIME) if(UNIX) @@ -1737,6 +1744,12 @@ macro(CUDA_ADD_LIBRARY cuda_target) ${CUDA_LIBRARIES} ) + if(CUDA_SEPARABLE_COMPILATION) + target_link_libraries(${cuda_target} + ${CUDA_cudadevrt_LIBRARY} + ) + endif() + # We need to set the linker language based on what the expected generated file # would be. CUDA_C_OR_CXX is computed based on CUDA_HOST_COMPILATION_CPP. set_target_properties(${cuda_target} |