From 33192e1b5f1cc8cce95f4d69cf7ecf0b6269f84b Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 6 Jul 2020 17:46:03 -0400 Subject: FindMPI: Pass -pthread to NVCC through -Xlinker for device linking Fixes: #20924 --- Modules/FindMPI.cmake | 2 ++ 1 file changed, 2 insertions(+) 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" "$<$:-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 -- cgit v0.12