summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-07-06 21:46:03 (GMT)
committerBrad King <brad.king@kitware.com>2020-07-07 14:23:11 (GMT)
commit33192e1b5f1cc8cce95f4d69cf7ecf0b6269f84b (patch)
tree5bfbcb47c2f24d1287133c83b7ca54280ac039f2
parent996b312825524b7e4595742b4892ba2a99e9536f (diff)
downloadCMake-33192e1b5f1cc8cce95f4d69cf7ecf0b6269f84b.zip
CMake-33192e1b5f1cc8cce95f4d69cf7ecf0b6269f84b.tar.gz
CMake-33192e1b5f1cc8cce95f4d69cf7ecf0b6269f84b.tar.bz2
FindMPI: Pass -pthread to NVCC through -Xlinker for device linking
Fixes: #20924
-rw-r--r--Modules/FindMPI.cmake2
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 45c0eb0..25de562 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -1164,6 +1164,8 @@ macro(_MPI_create_imported_target LANG)
set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}")
if(MPI_${LANG}_LINK_FLAGS)
+ string(REPLACE "-pthread" "$<$<LINK_LANG_AND_ID:CUDA,NVIDIA>:-Xlinker >-pthread"
+ _MPI_${LANG}_LINK_FLAGS "${MPI_${LANG}_LINK_FLAGS}")
set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_OPTIONS "SHELL:${MPI_${LANG}_LINK_FLAGS}")
endif()
# If the compiler links MPI implicitly, no libraries will be found as they're contained within