summaryrefslogtreecommitdiffstats
path: root/Modules/FindMPI.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-06-24 15:07:19 (GMT)
committerBrad King <brad.king@kitware.com>2010-06-24 15:07:19 (GMT)
commit68c7d3e2ce2fb98980887357dd6308246ea3d64e (patch)
tree5cc03cfe60ae931eeeb519ef95c76f51fe9889d3 /Modules/FindMPI.cmake
parentec10d005ce038281e634357697dcf223674fae77 (diff)
downloadCMake-68c7d3e2ce2fb98980887357dd6308246ea3d64e.zip
CMake-68c7d3e2ce2fb98980887357dd6308246ea3d64e.tar.gz
CMake-68c7d3e2ce2fb98980887357dd6308246ea3d64e.tar.bz2
FindMPI: Do not parse -l in middle of library name
We parse the output of 'mpicc -shome:link' to look for -l options specifying libraries. Fix the parsing regex to avoid matching the string '-l' in the middle of a library name.
Diffstat (limited to 'Modules/FindMPI.cmake')
-rw-r--r--Modules/FindMPI.cmake4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 481b0e9..90e738b 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -263,13 +263,13 @@ elseif (MPI_COMPILE_CMDLINE)
# Extract the set of libraries to link against from the link command
# line
- string(REGEX MATCHALL "-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
+ string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
# Determine full path names for all of the libraries that one needs
# to link against in an MPI program
set(MPI_LIBRARIES)
foreach(LIB ${MPI_LIBNAMES})
- string(REGEX REPLACE "^-l" "" LIB ${LIB})
+ string(REGEX REPLACE "^ ?-l" "" LIB ${LIB})
set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
find_library(MPI_LIB ${LIB} HINTS ${MPI_LINK_PATH})
if (MPI_LIB)