Commit 50206938 authored by PRUVOST Florent's avatar PRUVOST Florent

cmake modules find: update with morse

parent 69c8d416
......@@ -142,6 +142,7 @@ if (NOT BLAS_FOUND)
endif()
option(BLAS_VERBOSE "Print some additional information during BLAS libraries detection" OFF)
mark_as_advanced(BLAS_VERBOSE)
include(CheckFunctionExists)
include(CheckFortranFunctionExists)
......@@ -447,6 +448,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
find_library(M_LIBRARY
NAMES m
HINTS ${_libdir})
mark_as_advanced(M_LIBRARY)
if(M_LIBRARY)
set(LM "-lm")
else()
......@@ -1342,4 +1344,5 @@ if (BLAS_FOUND)
set(BLAS_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of BLAS library" FORCE)
endif()
endif()
mark_as_advanced(BLAS_DIR)
mark_as_advanced(BLAS_DIR_FOUND)
......@@ -40,6 +40,22 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# macro to factorize this call
macro(find_package_blas)
if(BLASEXT_FIND_REQUIRED)
if(BLASEXT_FIND_QUIETLY)
find_package(BLAS REQUIRED QUIET)
else()
find_package(BLAS REQUIRED)
endif()
else()
if(BLASEXT_FIND_QUIETLY)
find_package(BLAS QUIET)
else()
find_package(BLAS)
endif()
endif()
endmacro()
# add a cache variable to let the user specify the BLAS vendor
set(BLA_VENDOR "" CACHE STRING "list of possible BLAS vendor:
......@@ -67,11 +83,7 @@ if (NOT BLAS_FOUND)
# First try to detect two cases:
# 1: only SEQ libs are handled
# 2: both SEQ and PAR libs are handled
if(BLASEXT_FIND_REQUIRED)
find_package(BLAS REQUIRED)
else()
find_package(BLAS)
endif()
find_package_blas()
endif ()
# detect the cases where SEQ and PAR libs are handled
......@@ -181,12 +193,7 @@ if(BLA_VENDOR MATCHES "Intel*")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "Look for the sequential version Intel10_64lp_seq")
endif()
# if(NOT BLAS_FOUND AND BLASEXT_FIND_REQUIRED)
if(BLASEXT_FIND_REQUIRED)
find_package(BLAS REQUIRED)
else()
find_package(BLAS)
endif()
find_package_blas()
if(BLAS_FOUND)
set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
else()
......@@ -198,7 +205,7 @@ if(BLA_VENDOR MATCHES "Intel*")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "Look for the multithreaded version Intel10_64lp")
endif()
find_package(BLAS)
find_package_blas()
if(BLAS_FOUND)
set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")
else()
......@@ -220,11 +227,7 @@ elseif(BLA_VENDOR MATCHES "ACML*")
## look for the sequential version
set(BLA_VENDOR "ACML")
if(BLASEXT_FIND_REQUIRED)
find_package(BLAS REQUIRED)
else()
find_package(BLAS)
endif()
find_package_blas()
if(BLAS_FOUND)
set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
else()
......@@ -233,11 +236,7 @@ elseif(BLA_VENDOR MATCHES "ACML*")
## look for the multithreaded version
set(BLA_VENDOR "ACML_MP")
if(BLASEXT_FIND_REQUIRED)
find_package(BLAS REQUIRED)
else(BLAS_FOUND)
find_package(BLAS)
endif()
find_package_blas()
if(BLAS_FOUND)
set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")
else()
......@@ -249,11 +248,7 @@ elseif(BLA_VENDOR MATCHES "IBMESSL*")
## look for the sequential version
set(BLA_VENDOR "IBMESSL")
if(BLASEXT_FIND_REQUIRED)
find_package(BLAS REQUIRED)
else()
find_package(BLAS)
endif()
find_package_blas()
if(BLAS_FOUND)
set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
else()
......@@ -262,11 +257,7 @@ elseif(BLA_VENDOR MATCHES "IBMESSL*")
## look for the multithreaded version
set(BLA_VENDOR "IBMESSLMT")
if(BLASEXT_FIND_REQUIRED)
find_package(BLAS REQUIRED)
else(BLAS_FOUND)
find_package(BLAS)
endif()
find_package_blas()
if(BLAS_FOUND)
set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")
else()
......
......@@ -377,6 +377,8 @@ if (CBLAS_LIBRARIES)
set(CBLAS_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of CBLAS library" FORCE)
endif()
endif()
mark_as_advanced(CBLAS_DIR)
mark_as_advanced(CBLAS_DIR_FOUND)
# check that CBLAS has been found
# -------------------------------
......
......@@ -784,6 +784,8 @@ if (CHAMELEON_LIBRARIES)
set(CHAMELEON_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of CHAMELEON library" FORCE)
endif()
endif()
mark_as_advanced(CHAMELEON_DIR)
mark_as_advanced(CHAMELEON_DIR_FOUND)
# check that CHAMELEON has been found
# ---------------------------------
......
......@@ -339,6 +339,8 @@ if (EZTRACE_LIBRARIES)
set(EZTRACE_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of EZTRACE library" FORCE)
endif()
endif()
mark_as_advanced(EZTRACE_DIR)
mark_as_advanced(EZTRACE_DIR_FOUND)
# check that EZTRACE has been found
# -------------------------------
......
......@@ -719,6 +719,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
endif()
# m
find_library(M_LIBRARY NAMES m)
mark_as_advanced(M_LIBRARY)
if(M_LIBRARY)
list(APPEND REQUIRED_LIBS "-lm")
endif()
......@@ -787,6 +788,8 @@ if (FFTW_LIBRARIES)
set(FFTW_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of FFTW library" FORCE)
endif()
endif()
mark_as_advanced(FFTW_DIR)
mark_as_advanced(FFTW_DIR_FOUND)
# check that FFTW has been found
# -------------------------------
......
......@@ -294,6 +294,8 @@ if (FXT_LIBRARIES)
set(FXT_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of FXT library" FORCE)
endif()
endif()
mark_as_advanced(FXT_DIR)
mark_as_advanced(FXT_DIR_FOUND)
# check that FXT has been found
# -------------------------------
......
......@@ -300,6 +300,8 @@ if (HWLOC_LIBRARIES)
set(HWLOC_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of HWLOC library" FORCE)
endif()
endif()
mark_as_advanced(HWLOC_DIR)
mark_as_advanced(HWLOC_DIR_FOUND)
# check that HWLOC has been found
# -------------------------------
......
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2016 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# - Find HYPRE include dirs and libraries
# Use this module by invoking find_package with the form:
# find_package(HYPRE
# [REQUIRED]) # Fail with error if hypre is not found
#
# This module finds headers and hypre library.
# Results are reported in variables:
# HYPRE_FOUND - True if headers and requested libraries were found
# HYPRE_INCLUDE_DIRS - hypre include directories
# HYPRE_LIBRARY_DIRS - Link directories for hypre libraries
# HYPRE_LIBRARIES - hypre component libraries to be linked
#
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DHYPRE_DIR=path/to/hypre):
# HYPRE_DIR - Where to find the base directory of hypre
# HYPRE_INCDIR - Where to find the header files
# HYPRE_LIBDIR - Where to find the library files
# The module can also look for the following environment variables if paths
# are not given as cmake variable: HYPRE_DIR, HYPRE_INCDIR, HYPRE_LIBDIR
#=============================================================================
# Copyright 2016 Inria
# Copyright 2016 Florent Pruvost
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
if (NOT HYPRE_FOUND)
set(HYPRE_DIR "" CACHE PATH "Installation directory of HYPRE library")
if (NOT HYPRE_FIND_QUIETLY)
message(STATUS "A cache variable, namely HYPRE_DIR, has been set to specify the install directory of HYPRE")
endif()
endif()
set(ENV_HYPRE_DIR "$ENV{HYPRE_DIR}")
set(ENV_HYPRE_INCDIR "$ENV{HYPRE_INCDIR}")
set(ENV_HYPRE_LIBDIR "$ENV{HYPRE_LIBDIR}")
set(HYPRE_GIVEN_BY_USER "FALSE")
if ( HYPRE_DIR OR ( HYPRE_INCDIR AND HYPRE_LIBDIR) OR ENV_HYPRE_DIR OR (ENV_HYPRE_INCDIR AND ENV_HYPRE_LIBDIR) )
set(HYPRE_GIVEN_BY_USER "TRUE")
endif()
# Looking for include
# -------------------
# Add system include paths to search include
# ------------------------------------------
unset(_inc_env)
if(ENV_HYPRE_INCDIR)
list(APPEND _inc_env "${ENV_HYPRE_INCDIR}")
elseif(ENV_HYPRE_DIR)
list(APPEND _inc_env "${ENV_HYPRE_DIR}")
list(APPEND _inc_env "${ENV_HYPRE_DIR}/include")
list(APPEND _inc_env "${ENV_HYPRE_DIR}/include/hypre")
else()
if(WIN32)
string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")
else()
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
endif()
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
list(REMOVE_DUPLICATES _inc_env)
# set paths where to look for
set(PATH_TO_LOOK_FOR "${_inc_env}")
# Try to find the hypre header in the given paths
# -------------------------------------------------
# call cmake macro to find the header path
if(HYPRE_INCDIR)
set(HYPRE_HYPRE.h_DIRS "HYPRE_HYPRE.h_DIRS-NOTFOUND")
find_path(HYPRE_HYPRE.h_DIRS
NAMES HYPRE.h
HINTS ${HYPRE_INCDIR})
else()
if(HYPRE_DIR)
set(HYPRE_HYPRE.h_DIRS "HYPRE_HYPRE.h_DIRS-NOTFOUND")
find_path(HYPRE_HYPRE.h_DIRS
NAMES HYPRE.h
HINTS ${HYPRE_DIR}
PATH_SUFFIXES "include" "include/hypre")
else()
set(HYPRE_HYPRE.h_DIRS "HYPRE_HYPRE.h_DIRS-NOTFOUND")
find_path(HYPRE_HYPRE.h_DIRS
NAMES HYPRE.h
HINTS ${PATH_TO_LOOK_FOR}
PATH_SUFFIXES "hypre")
endif()
endif()
mark_as_advanced(HYPRE_HYPRE.h_DIRS)
# Add path to cmake variable
# ------------------------------------
if (HYPRE_HYPRE.h_DIRS)
set(HYPRE_INCLUDE_DIRS "${HYPRE_HYPRE.h_DIRS}")
else ()
set(HYPRE_INCLUDE_DIRS "HYPRE_INCLUDE_DIRS-NOTFOUND")
if(NOT HYPRE_FIND_QUIETLY)
message(STATUS "Looking for hypre -- HYPRE.h not found")
endif()
endif ()
if (HYPRE_INCLUDE_DIRS)
list(REMOVE_DUPLICATES HYPRE_INCLUDE_DIRS)
endif ()
# Looking for lib
# ---------------
# Add system library paths to search lib
# --------------------------------------
unset(_lib_env)
if(ENV_HYPRE_LIBDIR)
list(APPEND _lib_env "${ENV_HYPRE_LIBDIR}")
elseif(ENV_HYPRE_DIR)
list(APPEND _lib_env "${ENV_HYPRE_DIR}")
list(APPEND _lib_env "${ENV_HYPRE_DIR}/lib")
else()
if(WIN32)
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
else()
if(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
endif()
endif()
list(REMOVE_DUPLICATES _lib_env)
# set paths where to look for
set(PATH_TO_LOOK_FOR "${_lib_env}")
# Try to find the hypre lib in the given paths
# ----------------------------------------------
# call cmake macro to find the lib path
if(HYPRE_LIBDIR)
set(HYPRE_HYPRE_LIBRARY "HYPRE_HYPRE_LIBRARY-NOTFOUND")
find_library(HYPRE_HYPRE_LIBRARY
NAMES HYPRE
HINTS ${HYPRE_LIBDIR})
else()
if(HYPRE_DIR)
set(HYPRE_HYPRE_LIBRARY "HYPRE_HYPRE_LIBRARY-NOTFOUND")
find_library(HYPRE_HYPRE_LIBRARY
NAMES HYPRE
HINTS ${HYPRE_DIR}
PATH_SUFFIXES lib lib32 lib64)
else()
set(HYPRE_HYPRE_LIBRARY "HYPRE_HYPRE_LIBRARY-NOTFOUND")
find_library(HYPRE_HYPRE_LIBRARY
NAMES HYPRE
HINTS ${PATH_TO_LOOK_FOR})
endif()
endif()
mark_as_advanced(HYPRE_HYPRE_LIBRARY)
# If found, add path to cmake variable
# ------------------------------------
if (HYPRE_HYPRE_LIBRARY)
get_filename_component(hypre_lib_path ${HYPRE_HYPRE_LIBRARY} PATH)
# set cmake variables (respects naming convention)
set(HYPRE_LIBRARIES "${HYPRE_HYPRE_LIBRARY}")
set(HYPRE_LIBRARY_DIRS "${hypre_lib_path}")
else ()
set(HYPRE_LIBRARIES "HYPRE_LIBRARIES-NOTFOUND")
set(HYPRE_LIBRARY_DIRS "HYPRE_LIBRARY_DIRS-NOTFOUND")
if(NOT HYPRE_FIND_QUIETLY)
message(STATUS "Looking for hypre -- lib HYPRE not found")
endif()
endif ()
if (HYPRE_LIBRARY_DIRS)
list(REMOVE_DUPLICATES HYPRE_LIBRARY_DIRS)
endif ()
# check a function to validate the find
if(HYPRE_LIBRARIES)
set(REQUIRED_INCDIRS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
# HYPRE
if (HYPRE_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${HYPRE_INCLUDE_DIRS}")
endif()
if (HYPRE_LIBRARY_DIRS)
set(REQUIRED_LIBDIRS "${HYPRE_LIBRARY_DIRS}")
endif()
set(REQUIRED_LIBS "${HYPRE_LIBRARIES}")
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
set(CMAKE_REQUIRED_LIBRARIES)
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
# test link
unset(HYPRE_WORKS CACHE)
include(CheckFunctionExists)
check_function_exists(HYPRE_StructGridCreate HYPRE_WORKS)
mark_as_advanced(HYPRE_WORKS)
if(NOT HYPRE_WORKS)
if(NOT HYPRE_FIND_QUIETLY)
message(STATUS "Looking for HYPRE : test of HYPRE_StructGridCreate with HYPRE library fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_LIBRARIES)
endif(HYPRE_LIBRARIES)
if (HYPRE_LIBRARIES)
if (HYPRE_LIBRARY_DIRS)
list(GET HYPRE_LIBRARY_DIRS 0 first_lib_path)
else()
list(GET HYPRE_LIBRARIES 0 first_lib)
get_filename_component(first_lib_path "${first_lib}" PATH)
endif()
if (${first_lib_path} MATCHES "/lib(32|64)?$")
string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
set(HYPRE_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of HYPRE library" FORCE)
else()
set(HYPRE_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of HYPRE library" FORCE)
endif()
endif()
mark_as_advanced(HYPRE_DIR)
mark_as_advanced(HYPRE_DIR_FOUND)
# check that HYPRE has been found
# -------------------------------
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HYPRE DEFAULT_MSG
HYPRE_LIBRARIES
HYPRE_WORKS)
......@@ -105,6 +105,7 @@ endif (NOT LAPACK_FOUND)
option(LAPACK_VERBOSE "Print some additional information during LAPACK
libraries detection" OFF)
mark_as_advanced(LAPACK_VERBOSE)
if (BLAS_VERBOSE)
set(LAPACK_VERBOSE ON)
endif ()
......@@ -317,6 +318,7 @@ if(BLAS_FOUND)
if (UNIX AND NOT WIN32)
# m
find_library(M_LIBRARY NAMES m)
mark_as_advanced(M_LIBRARY)
if(M_LIBRARY)
set(LM "-lm")
else()
......@@ -431,6 +433,28 @@ if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
endif(NOT LAPACK_LIBRARIES)
endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
#open lapack
if (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All")
if(NOT LAPACK_LIBRARIES)
check_lapack_libraries(
LAPACK_LIBRARIES
LAPACK
cheev
""
"openblas"
"${BLAS_LIBRARIES}"
""
)
if(NOT LAPACK_FIND_QUIETLY)
if(LAPACK_LIBRARIES)
message(STATUS "Looking for Open LAPACK: found")
else()
message(STATUS "Looking for Open LAPACK: not found")
endif()
endif()
endif(NOT LAPACK_LIBRARIES)
endif (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All")
# LAPACK in IBM ESSL library (requires generic lapack lib, too)
if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
if(NOT LAPACK_LIBRARIES)
......@@ -640,3 +664,5 @@ if (LAPACK_FOUND)
set(LAPACK_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of LAPACK library" FORCE)
endif()
endif()
mark_as_advanced(LAPACK_DIR)
mark_as_advanced(LAPACK_DIR_FOUND)
......@@ -304,6 +304,7 @@ if (LAPACK_FOUND)
endif()
# m
find_library(M_LIBRARY NAMES m HINTS ${_lib_env})
mark_as_advanced(M_LIBRARY)
if(M_LIBRARY)
list(APPEND REQUIRED_LIBS "-lm")
endif()
......@@ -366,6 +367,8 @@ if (LAPACKE_LIBRARIES)
set(LAPACKE_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of LAPACKE library" FORCE)
endif()
endif()
mark_as_advanced(LAPACKE_DIR)
mark_as_advanced(LAPACKE_DIR_FOUND)
# check that LAPACKE has been found
# ---------------------------------
......
......@@ -40,19 +40,45 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# macro to factorize this call
macro(find_package_lapack)
if(LAPACKEXT_FIND_REQUIRED)
if(LAPACKEXT_FIND_QUIETLY)
find_package(LAPACK REQUIRED QUIET)
else()
find_package(LAPACK REQUIRED)
endif()
else()
if(LAPACKEXT_FIND_QUIETLY)
find_package(LAPACK QUIET)
else()
find_package(LAPACK)
endif()
endif()
endmacro()
# LAPACKEXT depends on BLASEXT
# call our extended module for BLAS
#----------------------------------
if (NOT BLAS_FOUND)
if(LAPACKEXT_FIND_REQUIRED)
find_package(BLASEXT REQUIRED)
if(LAPACKEXT_FIND_QUIETLY)
find_package(BLAS REQUIRED QUIET)
else()
find_package(BLAS REQUIRED)
endif()
else()
find_package(BLASEXT)
if(LAPACKEXT_FIND_QUIETLY)
find_package(BLAS QUIET)
else()
find_package(BLAS)
endif()
endif()
endif ()
message(STATUS "In FindLAPACKEXT")
if(NOT LAPACKEXT_FIND_QUIETLY)
message(STATUS "In FindLAPACKEXT")
endif()
if(BLA_VENDOR MATCHES "Intel*")
......@@ -125,12 +151,7 @@ if(BLA_VENDOR MATCHES "Intel*")
## look for the sequential version
set(BLA_VENDOR "Intel10_64lp_seq")
endif()
if(LAPACKEXT_FIND_REQUIRED)
find_package(LAPACK REQUIRED)
else()
find_package(LAPACK)
endif()
find_package_lapack()
if (LAPACK_FOUND)
if(BLAS_SEQ_LIBRARIES)
......@@ -152,12 +173,7 @@ elseif(BLA_VENDOR MATCHES "IBMESSL*")
## look for the sequential version
set(BLA_VENDOR "IBMESSL")
if(LAPACKEXT_FIND_REQUIRED)
find_package(LAPACK REQUIRED)
else()
find_package(LAPACK)
endif()
find_package_lapack()
if (LAPACK_FOUND)
if(LAPACK_LIBRARIES)
......@@ -169,12 +185,7 @@ elseif(BLA_VENDOR MATCHES "IBMESSL*")
## look for the multithreaded version
set(BLA_VENDOR "IBMESSLMT")
if(LAPACKEXT_FIND_REQUIRED)
find_package(LAPACK REQUIRED)
else()
find_package(LAPACK)
endif()
find_package_lapack()
if (LAPACK_FOUND)
if(LAPACK_LIBRARIES)
......@@ -189,11 +200,7 @@ elseif(BLA_VENDOR MATCHES "ACML*")
###
# look for libs
###
if(LAPACKEXT_FIND_REQUIRED)
find_package(LAPACK REQUIRED)
else()
find_package(LAPACK)
endif()
find_package_lapack()
if (LAPACK_FOUND)
if(BLAS_SEQ_LIBRARIES)
......@@ -228,11 +235,7 @@ else()
# all the possibilities
# BLA_F95 if set on tries to find the f95 interfaces for LAPACK/LAPACK
# Remark: it looks only into paths contained in the system environment variables
if(LAPACKEXT_FIND_REQUIRED)
find_package(LAPACK REQUIRED)
else()
find_package(LAPACK)
endif()
find_package_lapack()
if(LAPACK_FOUND)
set(LAPACK_SEQ_LIBRARIES "${LAPACK_LIBRARIES}")
......
......@@ -422,6 +422,8 @@ if (MAGMA_LIBRARIES)
set(MAGMA_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of MAGMA library" FORCE)
endif()
endif()
mark_as_advanced(MAGMA_DIR)
mark_as_advanced(MAGMA_DIR_FOUND)
# check that MAGMA has been found
# -------------------------------
......
......@@ -207,6 +207,7 @@ if(METIS_LIBRARIES)
set(REQUIRED_LIBS "${METIS_LIBRARIES}")
# m
find_library(M_LIBRARY NAMES m)
mark_as_advanced(M_LIBRARY)
if(M_LIBRARY)
list(APPEND REQUIRED_LIBS "-lm")
endif()
......@@ -249,6 +250,8 @@ if (METIS_LIBRARIES)
set(METIS_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of METIS library" FORCE)
endif()
endif()
mark_as_advanced(METIS_DIR)
mark_as_advanced(METIS_DIR_FOUND)
# check that METIS has been found
# ---------------------------------
......
......@@ -27,7 +27,9 @@
# - SEQ: to activate detection of sequential version (exclude MPI version)
# it looks for Threads and BLAS libraries
# - SCOTCH: to activate detection of MUMPS linked with SCOTCH
# - PTSCOTCH: to activate detection of MUMPS linked with PTSCOTCH
# - METIS: to activate detection of MUMPS linked with METIS
# - PARMETIS: to activate detection of MUMPS linked with PARMETIS
#
# This module finds headers and mumps library.
# Results are reported in variables:
......@@ -75,7 +77,9 @@ endif()
set(MUMPS_LOOK_FOR_MPI ON)
set(MUMPS_LOOK_FOR_SEQ OFF)
set(MUMPS_LOOK_FOR_SCOTCH OFF)
set(MUMPS_LOOK_FOR_PTSCOTCH OFF)
set(MUMPS_LOOK_FOR_METIS OFF)
set(MUMPS_LOOK_FOR_PARMETIS OFF)
if( MUMPS_FIND_COMPONENTS )
foreach( component ${MUMPS_FIND_COMPONENTS} )
......@@ -92,9 +96,15 @@ if( MUMPS_FIND_COMPONENTS )
if (${component} STREQUAL "SCOTCH")
set(MUMPS_LOOK_FOR_SCOTCH ON)
endif()
if (${component} STREQUAL "PTSCOTCH")
set(MUMPS_LOOK_FOR_PTSCOTCH ON)
endif()
if (${component} STREQUAL "METIS")
set(MUMPS_LOOK_FOR_METIS ON)
endif()
if (${component} STREQUAL "PARMETIS")
set(MUMPS_LOOK_FOR_PARMETIS ON)
endif()
endforeach()
endif()
......@@ -196,6 +206,19 @@ if (MUMPS_LOOK_FOR_SCOTCH)
endif()
endif()
# MUMPS may depends on PTSCOTCH
#------------------------------
if (MUMPS_LOOK_FOR_PTSCOTCH)
if (NOT MUMPS_FIND_QUIETLY)
message(STATUS "Looking for MUMPS - Try to detect PTSCOTCH with esmumps")
endif()
if (MUMPS_FIND_REQUIRED AND MUMPS_FIND_REQUIRED_PTSCOTCH)
find_package(PTSCOTCH REQUIRED COMPONENTS ESMUMPS)
else()
find_package(PTSCOTCH COMPONENTS ESMUMPS)
endif()
endif()
# MUMPS may depends on METIS