diff options
author | Brad King <brad.king@kitware.com> | 2018-10-25 14:27:48 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-10-25 14:41:19 (GMT) |
commit | e2d54e5c40c517698c856b6802b51e0c09d5dca6 (patch) | |
tree | f6de47c4f05d6910ab56275ce55fb4d76bdb4026 /Modules | |
parent | d81c4db489d773e4a1ce6be49eb9c41582e68ae3 (diff) | |
download | CMake-e2d54e5c40c517698c856b6802b51e0c09d5dca6.zip CMake-e2d54e5c40c517698c856b6802b51e0c09d5dca6.tar.gz CMake-e2d54e5c40c517698c856b6802b51e0c09d5dca6.tar.bz2 |
FindMPI: Pass -pthread to CUDA compiler through -Xcompiler
When adding this flag to imported targets, wrap it in a generator
expression to use `-Xcompiler` to pass the flag for CUDA.
Fixes: #17929
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindMPI.cmake | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index bfcd876..b94e69e 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -1131,7 +1131,12 @@ macro(_MPI_create_imported_target LANG) add_library(MPI::MPI_${LANG} INTERFACE IMPORTED) endif() - set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_OPTIONS "${MPI_${LANG}_COMPILE_OPTIONS}") + # When this is consumed for compiling CUDA, use '-Xcompiler' to wrap '-pthread'. + string(REPLACE "-pthread" "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler >-pthread" + _MPI_${LANG}_COMPILE_OPTIONS "${MPI_${LANG}_COMPILE_OPTIONS}") + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_OPTIONS "${_MPI_${LANG}_COMPILE_OPTIONS}") + unset(_MPI_${LANG}_COMPILE_OPTIONS) + set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${MPI_${LANG}_COMPILE_DEFINITIONS}") set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_LIBRARIES "") |