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.
This commit is contained in:
parent
6e9ea6c65a
commit
fa458957ab
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue