summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorDouglas Gregor <doug.gregor@gmail.com>2008-07-18 12:17:23 (GMT)
committerDouglas Gregor <doug.gregor@gmail.com>2008-07-18 12:17:23 (GMT)
commitfa458957ab8b4debb5c17c6da51da436a65d5540 (patch)
treeab70e8cd0dfc59d624a3917432fdb3296048550d /Modules
parent6e9ea6c65a69daf4854f8def22c1726d0381d59a (diff)
downloadCMake-fa458957ab8b4debb5c17c6da51da436a65d5540.zip
CMake-fa458957ab8b4debb5c17c6da51da436a65d5540.tar.gz
CMake-fa458957ab8b4debb5c17c6da51da436a65d5540.tar.bz2
ENH: Use the HINTS feature of find_library to find the right libraries for
MPI, and act a bit more intelligently when MPI cannot be found.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindMPI.cmake13
1 files changed, 7 insertions, 6 deletions
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index d568c94..03e95ef 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -210,11 +210,11 @@ elseif (MPI_COMPILE_CMDLINE)
foreach(LIB ${MPI_LIBNAMES})
string(REGEX REPLACE "^-l" "" LIB ${LIB})
set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
- find_library(MPI_LIB ${LIB} PATHS ${MPI_LINK_PATH})
+ find_library(MPI_LIB ${LIB} HINTS ${MPI_LINK_PATH})
if (MPI_LIB)
list(APPEND MPI_LIBRARIES ${MPI_LIB})
else (MPI_LIB)
- status(ERROR "Unable to find MPI library ${LIB}")
+ message(SEND_ERROR "Unable to find MPI library ${LIB}")
endif (MPI_LIB)
endforeach(LIB)
set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI detection" FORCE)
@@ -222,12 +222,13 @@ elseif (MPI_COMPILE_CMDLINE)
# Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and
# MPI_EXTRA_LIBRARY.
list(LENGTH MPI_LIBRARIES MPI_NUMLIBS)
- if (MPI_NUMLIBS GREATER 0)
+ list(LENGTH MPI_LIBNAMES MPI_NUMLIBS_EXPECTED)
+ if (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK)
set(MPI_LIBRARY ${MPI_LIBRARY_WORK} CACHE FILEPATH "MPI library to link against" FORCE)
- else (MPI_NUMLIBS GREATER 0)
- set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND" CACHE STRING "MPI library to link against" FORCE)
- endif (MPI_NUMLIBS GREATER 0)
+ else (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
+ set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND" CACHE FILEPATH "MPI library to link against" FORCE)
+ endif (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
if (MPI_NUMLIBS GREATER 1)
set(MPI_EXTRA_LIBRARY_WORK ${MPI_LIBRARIES})
list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0)