Browse Source

Merge branch 'FindMPI-imported-link-flags' into release-3.15

Merge-request: !3449
Brad King 6 years ago
parent
commit
1ca4be5d90
1 changed files with 3 additions and 1 deletions
  1. 3 1
      Modules/FindMPI.cmake

+ 3 - 1
Modules/FindMPI.cmake

@@ -1144,7 +1144,9 @@ macro(_MPI_create_imported_target LANG)
 
   set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_LIBRARIES "")
   if(MPI_${LANG}_LINK_FLAGS)
-    set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${MPI_${LANG}_LINK_FLAGS}")
+    separate_arguments(_MPI_${LANG}_LINK_FLAGS NATIVE_COMMAND "${MPI_${LANG}_LINK_FLAGS}")
+    set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${_MPI_${LANG}_LINK_FLAGS}")
+    unset(_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.