diff options
-rw-r--r-- | Modules/FindMPI.cmake | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index bea0d8d..c48decb 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -1187,9 +1187,10 @@ 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}") + string(REPLACE "," "$<COMMA>" _MPI_${LANG}_LINK_FLAGS "${MPI_${LANG}_LINK_FLAGS}") + string(PREPEND _MPI_${LANG}_LINK_FLAGS "$<HOST_LINK:SHELL:") + string(APPEND _MPI_${LANG}_LINK_FLAGS ">") + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_OPTIONS "${_MPI_${LANG}_LINK_FLAGS}") endif() # If the compiler links MPI implicitly, no libraries will be found as they're contained within # CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES already. |