summaryrefslogtreecommitdiffstats
path: root/Modules/FindMPI.cmake
diff options
context:
space:
mode:
authorDominic Meiser <dmeiser79@gmail.com>2016-04-14 17:03:21 (GMT)
committerBrad King <brad.king@kitware.com>2016-04-15 17:42:05 (GMT)
commit2a99fae1cc30938a50fd55afd50c13b5c881c737 (patch)
treed9273772b9054dd87b6538d15f3699d543954604 /Modules/FindMPI.cmake
parentc4417b0927991130d1c701f844e7e2b3464a207e (diff)
downloadCMake-2a99fae1cc30938a50fd55afd50c13b5c881c737.zip
CMake-2a99fae1cc30938a50fd55afd50c13b5c881c737.tar.gz
CMake-2a99fae1cc30938a50fd55afd50c13b5c881c737.tar.bz2
FindMPI: Recognize `.lib` file names for specification of link libraries
The Intel MPI compiler wrappers link against static MPI libraries simply by listing the libraries (no `-l`).
Diffstat (limited to 'Modules/FindMPI.cmake')
-rw-r--r--Modules/FindMPI.cmake11
1 files changed, 11 insertions, 0 deletions
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index ef4a7a1..fbc6795 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -385,6 +385,13 @@ function (interrogate_mpi_compiler lang try_libs)
# Extract the set of libraries to link against from the link command
# line
string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
+ if(WIN32)
+ # The intel wrappers on windows link against static versions of the MPI libraries.
+ # The static libraries are simply listed on the command line without -l.
+ # For instance: " icl ... impi.lib "
+ string(REGEX MATCHALL "(^| )([^\" ]+)\\.lib" tmp "${MPI_LINK_CMDLINE}")
+ list(APPEND MPI_LIBNAMES ${tmp})
+ endif()
# add the compiler implicit directories because some compilers
# such as the intel compiler have libraries that show up
@@ -399,6 +406,10 @@ function (interrogate_mpi_compiler lang try_libs)
# to link against in an MPI program
foreach(LIB ${MPI_LIBNAMES})
string(REGEX REPLACE "^ ?-l" "" LIB ${LIB})
+ if(WIN32)
+ string(REGEX REPLACE "\\.lib$" "" LIB ${LIB})
+ endif()
+ string(STRIP ${LIB} LIB)
# MPI_LIB is cached by find_library, but we don't want that. Clear it first.
set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
find_library(MPI_LIB NAMES ${LIB} HINTS ${MPI_LINK_PATH})