summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorChristian Pfeiffer <cpfeiffer@live.de>2017-12-05 13:03:37 (GMT)
committerChristian Pfeiffer <cpfeiffer@live.de>2017-12-05 13:14:40 (GMT)
commitbde7513d2fcd7a366eb4dd93fc1f061334743bb7 (patch)
tree9aa5b4360860466c693aff4aa6ea410b158b6a95 /Modules
parent7746fdb2fe0177341aadeafec2ae73aa08ddfaf6 (diff)
downloadCMake-bde7513d2fcd7a366eb4dd93fc1f061334743bb7.zip
CMake-bde7513d2fcd7a366eb4dd93fc1f061334743bb7.tar.gz
CMake-bde7513d2fcd7a366eb4dd93fc1f061334743bb7.tar.bz2
FindMPI: Correct legacy variable handling
Due to a minor logic error, MPI_LIBRARY, MPI_EXTRA_LIBRARY and MPI_<LANG>_LIBRARIES hints are currently not correctly handled and discarded. Additionally, if either C or CXX aren't enabled, there subsequent calls to FindMPI will cause cache variables of the sort "MPI_MPI_EXTRA_LIBRARY-NOTFOUND" to appear due to an error in the compatibility handling. (Doesn't affect functionality)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindMPI.cmake26
1 files changed, 16 insertions, 10 deletions
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 7f4c44c..21ac0bc 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -602,6 +602,9 @@ function (_MPI_interrogate_compiler lang)
if(MPI_DIRECT_LIB_NAMES_WORK)
set(MPI_PLAIN_LIB_NAMES_WORK "${MPI_DIRECT_LIB_NAMES_WORK};${MPI_PLAIN_LIB_NAMES_WORK}")
endif()
+ if(MPI_${LANG}_EXTRA_LIB_NAMES)
+ list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${MPI_${LANG}_EXTRA_LIB_NAMES}")
+ endif()
# MPI might require pthread to work. The above mechanism wouldn't detect it, but we need to
# link it in that case. -lpthread is covered by the normal library treatment on the other hand.
@@ -1076,18 +1079,21 @@ foreach (LANG IN ITEMS C CXX)
endif()
# If a list of libraries was given, we'll split it into new-style cache variables
+ unset(MPI_${LANG}_EXTRA_LIB_NAMES)
if(NOT MPI_${LANG}_LIB_NAMES)
foreach(_MPI_LIB IN LISTS MPI_${LANG}_LIBRARIES MPI_LIBRARY MPI_EXTRA_LIBRARY)
- get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE)
- get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME)
- get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY)
- list(APPEND MPI_PLAIN_LIB_NAMES_WORK "${_MPI_PLAIN_LIB_NAME}")
- find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY
- NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}"
- HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB}
- DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI"
- )
- mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY)
+ if(_MPI_LIB)
+ get_filename_component(_MPI_PLAIN_LIB_NAME "${_MPI_LIB}" NAME_WE)
+ get_filename_component(_MPI_LIB_NAME "${_MPI_LIB}" NAME)
+ get_filename_component(_MPI_LIB_DIR "${_MPI_LIB}" DIRECTORY)
+ list(APPEND MPI_${LANG}_EXTRA_LIB_NAMES "${_MPI_PLAIN_LIB_NAME}")
+ find_library(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY
+ NAMES "${_MPI_LIB_NAME}" "lib${_MPI_LIB_NAME}"
+ HINTS ${_MPI_LIB_DIR} $ENV{MPI_LIB}
+ DOC "Location of the ${_MPI_PLAIN_LIB_NAME} library for MPI"
+ )
+ mark_as_advanced(MPI_${_MPI_PLAIN_LIB_NAME}_LIBRARY)
+ endif()
endforeach()
endif()
endforeach()