Ver Fonte

Merge topic 'FindMPI-host_link' into release-3.20

666f689e48 FindMPI: avoid host link options to be propagated to device link step

Acked-by: Kitware Robot <[email protected]>
Acked-by: Robert Maynard <[email protected]>
Acked-by: Alex <[email protected]>
Merge-request: !5966
Brad King há 4 anos atrás
pai
commit
daba4a0250
1 ficheiros alterados com 4 adições e 3 exclusões
  1. 4 3
      Modules/FindMPI.cmake

+ 4 - 3
Modules/FindMPI.cmake

@@ -1182,9 +1182,10 @@ macro(_MPI_create_imported_target LANG)
   set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}")
   set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}")
 
 
   if(MPI_${LANG}_LINK_FLAGS)
   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()
   endif()
   # If the compiler links MPI implicitly, no libraries will be found as they're contained within
   # If the compiler links MPI implicitly, no libraries will be found as they're contained within
   # CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES already.
   # CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES already.