summaryrefslogtreecommitdiff
path: root/Modules/FindCUDA.cmake
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-02-20 08:18:00 -0500
committerBrad King <brad.king@kitware.com>2020-02-24 14:14:38 -0500
commitb9d67447c35681ccf272ec1744cb3208aa2745ba (patch)
tree4ad873119f537f4783b4842c599c69571cfe913d /Modules/FindCUDA.cmake
parent125f0451a9061c60036c5f92d104ee9fb3111a98 (diff)
downloadcmake-b9d67447c35681ccf272ec1744cb3208aa2745ba.tar.gz
FindCUDA: Only depend on Threads::Threads on platforms that need it
In commit 46371132b3 (FindCUDA: CUDA_LIBRARIES doesn't contain raw `-pthread`, 2019-11-11, v3.17.0-rc1~455^2) we introduced use of the `Threads::Threads` target, but we do not `find_package(Threads)` on all platforms. Use the target only if it exists.
Diffstat (limited to 'Modules/FindCUDA.cmake')
-rw-r--r--Modules/FindCUDA.cmake6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 0e2f551f3e..e1af2d6185 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -929,7 +929,11 @@ set(CUDA_LIBRARIES)
if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY)
list(APPEND CUDA_LIBRARIES ${CUDA_CUDARTEMU_LIBRARY})
elseif(CUDA_USE_STATIC_CUDA_RUNTIME AND CUDA_cudart_static_LIBRARY)
- list(APPEND CUDA_LIBRARIES ${CUDA_cudart_static_LIBRARY} Threads::Threads ${CMAKE_DL_LIBS})
+ list(APPEND CUDA_LIBRARIES ${CUDA_cudart_static_LIBRARY})
+ if (TARGET Threads::Threads)
+ list(APPEND CUDA_LIBRARIES Threads::Threads)
+ endif()
+ list(APPEND CUDA_LIBRARIES ${CMAKE_DL_LIBS})
if (CUDA_rt_LIBRARY)
list(APPEND CUDA_LIBRARIES ${CUDA_rt_LIBRARY})
endif()