# - Try to find SCALAPACK
#

find_path (SCALAPACK_DIR lib/libscalapack.a HINTS ENV SCALAPACK_DIR PATHS $ENV{HOME}/scalapack DOC "ScaLapack Directory")


IF(EXISTS ${SCALAPACK_DIR}/lib/libscalapack.a)
  SET(SCALAPACK_FOUND YES)
  SET(SCALAPACK_INCLUDES ${SCALAPACK_DIR})
  find_path (SCALAPACK_INCLUDE_DIR mumps_compat.h HINTS "${SCALAPACK_DIR}" PATH_SUFFIXES include NO_DEFAULT_PATH)
  list(APPEND SCALAPACK_INCLUDES ${SCALAPACK_INCLUDE_DIR})
  FILE(GLOB SCALAPACK_LIBRARIES RELATIVE "${SCALAPACK_DIR}/lib" "${SCALAPACK_DIR}/lib/libscalapack*.a")
ELSE(EXISTS ${SCALAPACK_DIR}/lib/libscalapack.a)
  SET(SCALAPACK_FOUND NO)
ENDIF(EXISTS ${SCALAPACK_DIR}/lib/libscalapack.a)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SCALAPACK DEFAULT_MSG SCALAPACK_LIBRARIES SCALAPACK_INCLUDES)