summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2021-03-31 16:05:24 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2021-04-01 14:23:08 (GMT)
commit666f689e48c15c3d0bd524b43beb62dd16790ace (patch)
tree3eb7513b96a806f4ea563a015eb9ea5225e0c32f /Modules
parent049757b8a8aae5471fe9a8421fc588e82d46bd02 (diff)
downloadCMake-666f689e48c15c3d0bd524b43beb62dd16790ace.zip
CMake-666f689e48c15c3d0bd524b43beb62dd16790ace.tar.gz
CMake-666f689e48c15c3d0bd524b43beb62dd16790ace.tar.bz2
FindMPI: avoid host link options to be propagated to device link step
Fixes: #21887
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindMPI.cmake7
1 files 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" "$<$<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.