summaryrefslogtreecommitdiff
path: root/Modules/FindMPI.cmake
diff options
context:
space:
mode:
authorChristian Pfeiffer <cpfeiffer@live.de>2019-04-20 20:45:09 +0200
committerChristian Pfeiffer <cpfeiffer@live.de>2019-04-20 20:45:09 +0200
commit7db32efbab1c61e4b8032702eba5ac6d7768d531 (patch)
treed84d77e590af3ad7df6279899f451ff6afaa83e0 /Modules/FindMPI.cmake
parent0116bb19d354f1bdc8ae1152202ff5d829b4acf7 (diff)
downloadcmake-7db32efbab1c61e4b8032702eba5ac6d7768d531.tar.gz
FindMPI: Don't retain libdirs for Win32
On Windows systems, the need to retain library directories should not nomrally occur. This can only occur on Unix like systems where a shared library is being linked that has a dependency on another library which is not being found in the default directories (e.g. libgfortran on BSD) This also works around an issue introduced by !1694 in that the Visual Studio generator does not handle link flags passed in `INTERFACE_LINK_LIBRARIES` correctly, causing problems when using that generator with Intel MPI in certain circumstances.
Diffstat (limited to 'Modules/FindMPI.cmake')
-rw-r--r--Modules/FindMPI.cmake26
1 files changed, 14 insertions, 12 deletions
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 8c45a8c5ff..5288640b60 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -770,18 +770,20 @@ function (_MPI_interrogate_compiler LANG)
endforeach()
# Add the link directories given explicitly that we haven't used back as linker directories.
- foreach(_MPI_LINK_DIRECTORY IN LISTS MPI_LINK_DIRECTORIES_LEFTOVER)
- file(TO_NATIVE_PATH "${_MPI_LINK_DIRECTORY}" _MPI_LINK_DIRECTORY_ACTUAL)
- string(FIND "${_MPI_LINK_DIRECTORY_ACTUAL}" " " _MPI_LINK_DIRECTORY_CONTAINS_SPACE)
- if(NOT _MPI_LINK_DIRECTORY_CONTAINS_SPACE EQUAL -1)
- set(_MPI_LINK_DIRECTORY_ACTUAL "\"${_MPI_LINK_DIRECTORY_ACTUAL}\"")
- endif()
- if(MPI_LINK_FLAGS_WORK)
- string(APPEND MPI_LINK_FLAGS_WORK " ${CMAKE_LIBRARY_PATH_FLAG}${_MPI_LINK_DIRECTORY_ACTUAL}")
- else()
- set(MPI_LINK_FLAGS_WORK "${CMAKE_LIBRARY_PATH_FLAG}${_MPI_LINK_DIRECTORY_ACTUAL}")
- endif()
- endforeach()
+ if(NOT WIN32)
+ foreach(_MPI_LINK_DIRECTORY IN LISTS MPI_LINK_DIRECTORIES_LEFTOVER)
+ file(TO_NATIVE_PATH "${_MPI_LINK_DIRECTORY}" _MPI_LINK_DIRECTORY_ACTUAL)
+ string(FIND "${_MPI_LINK_DIRECTORY_ACTUAL}" " " _MPI_LINK_DIRECTORY_CONTAINS_SPACE)
+ if(NOT _MPI_LINK_DIRECTORY_CONTAINS_SPACE EQUAL -1)
+ set(_MPI_LINK_DIRECTORY_ACTUAL "\"${_MPI_LINK_DIRECTORY_ACTUAL}\"")
+ endif()
+ if(MPI_LINK_FLAGS_WORK)
+ string(APPEND MPI_LINK_FLAGS_WORK " ${CMAKE_LIBRARY_PATH_FLAG}${_MPI_LINK_DIRECTORY_ACTUAL}")
+ else()
+ set(MPI_LINK_FLAGS_WORK "${CMAKE_LIBRARY_PATH_FLAG}${_MPI_LINK_DIRECTORY_ACTUAL}")
+ endif()
+ endforeach()
+ endif()
# Deal with the libraries given with full path next
unset(MPI_DIRECT_LIB_NAMES_WORK)