mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 00:11:07 -06:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user