From 666f689e48c15c3d0bd524b43beb62dd16790ace Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Wed, 31 Mar 2021 18:05:24 +0200 Subject: FindMPI: avoid host link options to be propagated to device link step Fixes: #21887 --- Modules/FindMPI.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 195ca49..de38ac2 100644 --- a/Modules/FindMPI.cmake +++ b/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}") 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}") + string(REPLACE "," "$" _MPI_${LANG}_LINK_FLAGS "${MPI_${LANG}_LINK_FLAGS}") + string(PREPEND _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__IMPLICIT_LINK_LIBRARIES already. -- cgit v0.12