diff options
author | Stephen Sorley <Stephen.Sorley@jhuapl.edu> | 2016-08-11 19:54:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-08-12 13:28:38 (GMT) |
commit | 1aa5c1bec82537ccbff8e05ae989b8befbdd286e (patch) | |
tree | 198b7174b2ad41cd96118625153f3dc669e8cc44 /Modules/FindCUDA.cmake | |
parent | aab1f6e984e81f732ec2dd5c33ff8f7bf604a0f2 (diff) | |
download | CMake-1aa5c1bec82537ccbff8e05ae989b8befbdd286e.zip CMake-1aa5c1bec82537ccbff8e05ae989b8befbdd286e.tar.gz CMake-1aa5c1bec82537ccbff8e05ae989b8befbdd286e.tar.bz2 |
FindCUDA: Fix missing librt on Linux when using static cuda runtime.
Commit 7229ae72 (FindCUDA: Refactor Android(Tegra) support, 2016-04-19)
changed the logic to only add librt to the link line for CUDA versions
6.5 and older. However, newer versions of CUDA still require librt.
Diffstat (limited to 'Modules/FindCUDA.cmake')
-rw-r--r-- | Modules/FindCUDA.cmake | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 972068b..78b716d 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -818,12 +818,13 @@ if(CUDA_USE_STATIC_CUDA_RUNTIME) else() unset(CMAKE_THREAD_PREFER_PTHREAD) endif() - endif() - if (UNIX AND NOT APPLE AND CUDA_VERSION VERSION_LESS "7.0") - # Before CUDA 7.0, there was librt that has things such as, clock_gettime, shm_open, and shm_unlink. - find_library(CUDA_rt_LIBRARY rt) - if (NOT CUDA_rt_LIBRARY) - message(WARNING "Expecting to find librt for libcudart_static, but didn't find it.") + + if(NOT APPLE) + #On Linux, you must link against librt when using the static cuda runtime. + find_library(CUDA_rt_LIBRARY rt) + if (NOT CUDA_rt_LIBRARY) + message(WARNING "Expecting to find librt for libcudart_static, but didn't find it.") + endif() endif() endif() endif() |