From 80d37167fed1178872d28cbcbf57c7a3660bf244 Mon Sep 17 00:00:00 2001 From: Tobias Ribizel Date: Sat, 23 May 2020 01:15:35 +0200 Subject: Find{Threads,MPI}: Add support for CUDA with Clang Currently CMake passes `-Xcompiler -pthread` flags to CUDA compilers irrespective of the actual CUDA compiler ID. This makes sure the additional `-Xcompiler` flag is only used with nvcc. --- Modules/FindMPI.cmake | 2 +- Modules/FindThreads.cmake | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index e9b6bd2..786bcc8 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -1154,7 +1154,7 @@ macro(_MPI_create_imported_target LANG) endif() # When this is consumed for compiling CUDA, use '-Xcompiler' to wrap '-pthread'. - string(REPLACE "-pthread" "$<$:SHELL:-Xcompiler >-pthread" + string(REPLACE "-pthread" "$<$:SHELL:-Xcompiler >-pthread" _MPI_${LANG}_COMPILE_OPTIONS "${MPI_${LANG}_COMPILE_OPTIONS}") set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_OPTIONS "${_MPI_${LANG}_COMPILE_OPTIONS}") unset(_MPI_${LANG}_COMPILE_OPTIONS) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index f97e5c8..ee49867 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -238,8 +238,8 @@ if(THREADS_FOUND AND NOT TARGET Threads::Threads) if(THREADS_HAVE_PTHREAD_ARG) set_property(TARGET Threads::Threads - PROPERTY INTERFACE_COMPILE_OPTIONS "$<$:SHELL:-Xcompiler -pthread>" - "$<$>:-pthread>") + PROPERTY INTERFACE_COMPILE_OPTIONS "$<$:SHELL:-Xcompiler -pthread>" + "$<$>:-pthread>") endif() if(CMAKE_THREAD_LIBS_INIT) -- cgit v0.12