Browse Source

FindCUDA: CUDA_LIBRARIES doesn't contain raw `-pthread`

If a person tried to pass `CUDA_LIBRARIES` to nvcc compiler it could
fail as it might have `-pthread` which nvcc doesn't support. Instead
we now use the `Threads::Threads` so that nvcc gets the correct
`-Xcompiler -pthread` flag.
Robert Maynard 6 years ago
parent
commit
46371132b3
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Modules/FindCUDA.cmake

+ 1 - 1
Modules/FindCUDA.cmake

@@ -924,7 +924,7 @@ set(CUDA_LIBRARIES)
 if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY)
 if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY)
   list(APPEND CUDA_LIBRARIES ${CUDA_CUDARTEMU_LIBRARY})
   list(APPEND CUDA_LIBRARIES ${CUDA_CUDARTEMU_LIBRARY})
 elseif(CUDA_USE_STATIC_CUDA_RUNTIME AND CUDA_cudart_static_LIBRARY)
 elseif(CUDA_USE_STATIC_CUDA_RUNTIME AND CUDA_cudart_static_LIBRARY)
-  list(APPEND CUDA_LIBRARIES ${CUDA_cudart_static_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
+  list(APPEND CUDA_LIBRARIES ${CUDA_cudart_static_LIBRARY} Threads::Threads ${CMAKE_DL_LIBS})
   if (CUDA_rt_LIBRARY)
   if (CUDA_rt_LIBRARY)
     list(APPEND CUDA_LIBRARIES ${CUDA_rt_LIBRARY})
     list(APPEND CUDA_LIBRARIES ${CUDA_rt_LIBRARY})
   endif()
   endif()