[cmake] FindMUMPS: try to be more robust
@@ -15,32 +15,43 @@ INCLUDE(FindPackageHandleStandardArgs)
IF(IDONTWANTMPI)
SET(__MUMPS_NAMES dmumps_seq dmumps)
ELSE(IDONTWANTMPI)
+# on debian systems one may have mumps+[pt]scotch packages also
SET(__MUMPS_NAMES dmumps_ptscotch dmumps_scotch dmumps)
ENDIF(IDONTWANTMPI)
IF(MUMPS_LIBRARY_DIRECTORY)
+ MESSAGE(STATUS "Searching for ${__MUMPS_NAMES} in ${MUMPS_LIBRARY_DIRECTORY}")
FIND_LIBRARY(MUMPS_LIBRARY NAMES ${__MUMPS_NAMES} PATHS "${MUMPS_LIBRARY_DIRECTORY}" NO_DEFAULT_PATH)
IF(NOT MUMPS_LIBRARY)
SET(_MUMPS_DEFAULT_SEARCH_DIR TRUE)
MESSAGE("Could not find MUMPS in directory ${MUMPS_LIBRARY_DIRECTORY}")
- FIND_LIBRARY(MUMPS_LIBRARY NAMES ${__MUMPS_NAMES})
ENDIF()
-ELSE(MUMPS_LIBRARY_DIRECTORY)
+ENDIF()
+
+IF(NOT MUMPS_LIBRARY)
+ MESSAGE(STATUS "Searching for ${__MUMPS_NAMES} in default directories")
FIND_LIBRARY(MUMPS_LIBRARY NAMES ${__MUMPS_NAMES})
-ENDIF(MUMPS_LIBRARY_DIRECTORY)
+ENDIF()
+IF(MUMPS_LIBRARY)
+ MESSAGE(STATUS "Found ${MUMPS_LIBRARY}")
+ENDIF()
# Try to be smart and detect whether the MUMPS lib file has a "_seq" suffix. If yes, we add it to all the other library
-IF(IDONTWANTMPI AND MUMPS_LIBRARY MATCHES "dmumps_seq")
+IF(MUMPS_LIBRARY MATCHES "dmumps_seq")
SET(__MUMPS_COMMON_NAMES mumps_common_seq mumps_common)
ELSE()
- SET(__MUMPS_COMMON_NAMES mumps_common_ptscotch mumps_common_scotch mumps_common)
+ SET(__MUMPS_COMMON_NAMES mumps_common_ptscotch mumps_common_scotch mumps_common mumps_common_seq)
ENDIF()
IF(MUMPS_LIBRARY_DIRECTORY AND NOT _MUMPS_DEFAULT_SEARCH_DIR)
- FIND_LIBRARY(MUMPS_COMMON_LIBRARY ${__MUMPS_COMMON_NAMES} PATHS "${MUMPS_LIBRARY_DIRECTORY}" NO_DEFAULT_PATH)
-ELSE()
- FIND_LIBRARY(MUMPS_COMMON_LIBRARY ${__MUMPS_COMMON_NAMES})
+ MESSAGE(STATUS "Searching for ${__MUMPS_COMMON_NAMES} in ${MUMPS_LIBRARY_DIRECTORY}")
+ FIND_LIBRARY(MUMPS_COMMON_LIBRARY NAMES ${__MUMPS_COMMON_NAMES} PATHS "${MUMPS_LIBRARY_DIRECTORY}" NO_DEFAULT_PATH)
+ENDIF()
+
+IF(NOT MUMPS_COMMON_LIBRARY)
+ MESSAGE(STATUS "Searching for ${__MUMPS_COMMON_NAMES} in default directories")
+ FIND_LIBRARY(MUMPS_COMMON_LIBRARY NAMES ${__MUMPS_COMMON_NAMES})
ENDIF()
IF(MUMPS_LIBRARY_DIRECTORY)
