diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000000000000000000000000000000000000..1890ae4a32b11aac1385e7197f94884697c3d386
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,14 @@
+image: hpclib/hiepacs
+
+Find:
+  artifacts:
+    name: find_ctests
+    expire_in: 1 week
+    paths:
+     - modules/find/tests/build/Testing/
+  script:
+    - cd modules/find/tests
+    - mkdir -p build
+    - cd build
+    - cmake .. -DENABLE_CTEST=ON -DLAPACKE_COMPONENTS="TMG" -DQUARK_COMPONENTS="HWLOC" -DPASTIX_COMPONENTS="PARSEC;STARPU"
+    - ctest -V
diff --git a/README.md b/README.md
index dd2909f00c573f70fa501dd68a04303745df8217..35a6fcb46b341e4adc3f2742dfe64281703a195c 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ master branch:
 Documentation
 ---------------------
 
-TODO
+See the file [morse_cmakefind_doc.org](modules/find/morse_cmakefind_doc.org).
 
 Installation
 ---------------------
@@ -32,10 +32,14 @@ CMake project and include the MorseInit module:
     list(APPEND CMAKE_MODULE_PATH "${MORSE_CMAKE_MODULE_PATH}/modules/" )
     # Include the init module
     include(MorseInit)
-    #
 
 We recommend to use this project as a `git submodule` of your project.
 
+Testing
+---------------------
+
+See the file [README](modules/find/tests/README.md).
+
 Get involved!
 ---------------------
 
diff --git a/modules/AuxilaryFlags.cmake b/modules/AuxilaryFlags.cmake
index 9744d578b6eada54ef12355b27d1ff3000da2fb9..1a17823a24b634872522fcb94a3947e22d55fae9 100644
--- a/modules/AuxilaryFlags.cmake
+++ b/modules/AuxilaryFlags.cmake
@@ -34,19 +34,19 @@
 if (MORSE_ENABLE_WARNING)
 
   if(CMAKE_C_COMPILER_ID MATCHES GNU)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fdiagnostics-show-option")
   elseif(CMAKE_C_COMPILER_ID MATCHES Intel)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w3 -diag-disable:remark")
   endif()
 
   if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fdiagnostics-show-option")
   elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w3 -diag-disable:remark")
   endif()
 
   if(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
-    set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wall")
+    set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wall -fdiagnostics-show-option")
   elseif(CMAKE_Fortran_COMPILER_ID MATCHES Intel)
     set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -warn all -diag-disable:remark")
   endif()
@@ -56,21 +56,21 @@ endif(MORSE_ENABLE_WARNING)
 if (MORSE_ENABLE_COVERAGE)
 
   if(CMAKE_C_COMPILER_ID MATCHES GNU)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fno-inline --coverage")
   else()
     message(FATAL_ERROR "Code coverage is only available with the GNU C (gcc)"
       "\n   compiler, please turn MORSE_ENABLE_COVERAGE OFF\n.")
   endif()
 
   if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fno-inline --coverage")
   else()
     message(FATAL_ERROR "Code coverage is only available with the GNU CXX"
       "\n   (g++) compiler, please turn MORSE_ENABLE_COVERAGE OFF\n.")
   endif()
 
   if(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
-    set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} --coverage")
+    set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fPIC -fno-inline --coverage")
   else()
     message(FATAL_ERROR "Code coverage is only available with the GNU"
       "\n   Fortran (gfortran) compiler, please turn MORSE_ENABLE_COVERAGE"
diff --git a/modules/find/FindBLAS.cmake b/modules/find/FindBLAS.cmake
index 9f74b07feb2b7cad89bd372c43639593fee150a9..2d0093a198408193417f7e6a1634edafc2dd536a 100644
--- a/modules/find/FindBLAS.cmake
+++ b/modules/find/FindBLAS.cmake
@@ -30,7 +30,7 @@
 #  BLA_STATIC  if set on this determines what kind of linkage we do (static)
 #  BLA_VENDOR  if set checks only the specified vendor, if not set checks
 #     all the possibilities
-#  BLAS_VENDOR_FOUND stores the BLAS vendor found 
+#  BLAS_VENDOR_FOUND stores the BLAS vendor found
 #  BLA_F95     if set on tries to find the f95 interfaces for BLAS/LAPACK
 # The user can give specific paths where to find the libraries adding cmake
 # options at configure (ex: cmake path/to/project -DBLAS_DIR=path/to/blas):
@@ -95,18 +95,18 @@ macro(Print_Find_Library_Blas_Status _libname _lib_to_find)
   else()
     if(${LIBNAME}_DIR)
       message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}"
-	"has not been found in ${ARGN}${ColourReset}")
+        "has not been found in ${ARGN}${ColourReset}")
     else()
       message("${Yellow}${_lib_to_find} not found."
-	"Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR"
-	"are defined so that we look for ${_lib_to_find} in"
-	"system paths (Linux: LD_LIBRARY_PATH, Windows: LIB,"
-	"Mac: DYLD_LIBRARY_PATH,"
-	"CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES,"
-	"CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}")
+        "Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR"
+        "are defined so that we look for ${_lib_to_find} in"
+        "system paths (Linux: LD_LIBRARY_PATH, Windows: LIB,"
+        "Mac: DYLD_LIBRARY_PATH,"
+        "CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES,"
+        "CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}")
       if(_lib_env)
-	message("${Yellow}${_lib_to_find} has not been found in"
-	  "${_lib_env}${ColourReset}")
+        message("${Yellow}${_lib_to_find} has not been found in"
+          "${_lib_env}${ColourReset}")
       endif()
     endif()
   endif()
@@ -192,11 +192,11 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
       list(APPEND _libdir "${BLAS_DIR}")
       list(APPEND _libdir "${BLAS_DIR}/lib")
       if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
-	list(APPEND _libdir "${BLAS_DIR}/lib64")
-	list(APPEND _libdir "${BLAS_DIR}/lib/intel64")
+        list(APPEND _libdir "${BLAS_DIR}/lib64")
+        list(APPEND _libdir "${BLAS_DIR}/lib/intel64")
       else()
-	list(APPEND _libdir "${BLAS_DIR}/lib32")
-	list(APPEND _libdir "${BLAS_DIR}/lib/ia32")
+        list(APPEND _libdir "${BLAS_DIR}/lib32")
+        list(APPEND _libdir "${BLAS_DIR}/lib/ia32")
       endif()
     elseif(ENV_BLAS_LIBDIR)
       list(APPEND _libdir "${ENV_BLAS_LIBDIR}")
@@ -204,29 +204,29 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
       list(APPEND _libdir "${ENV_BLAS_DIR}")
       list(APPEND _libdir "${ENV_BLAS_DIR}/lib")
       if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
-	list(APPEND _libdir "${ENV_BLAS_DIR}/lib64")
-	list(APPEND _libdir "${ENV_BLAS_DIR}/lib/intel64")
+        list(APPEND _libdir "${ENV_BLAS_DIR}/lib64")
+        list(APPEND _libdir "${ENV_BLAS_DIR}/lib/intel64")
       else()
-	list(APPEND _libdir "${ENV_BLAS_DIR}/lib32")
-	list(APPEND _libdir "${ENV_BLAS_DIR}/lib/ia32")
+        list(APPEND _libdir "${ENV_BLAS_DIR}/lib32")
+        list(APPEND _libdir "${ENV_BLAS_DIR}/lib/ia32")
       endif()
     else()
       if (ENV_MKLROOT)
-	list(APPEND _libdir "${ENV_MKLROOT}/lib")
-	if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
-	  list(APPEND _libdir "${ENV_MKLROOT}/lib64")
-	  list(APPEND _libdir "${ENV_MKLROOT}/lib/intel64")
-	else()
-	  list(APPEND _libdir "${ENV_MKLROOT}/lib32")
-	  list(APPEND _libdir "${ENV_MKLROOT}/lib/ia32")
-	endif()
+        list(APPEND _libdir "${ENV_MKLROOT}/lib")
+        if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+          list(APPEND _libdir "${ENV_MKLROOT}/lib64")
+          list(APPEND _libdir "${ENV_MKLROOT}/lib/intel64")
+        else()
+          list(APPEND _libdir "${ENV_MKLROOT}/lib32")
+          list(APPEND _libdir "${ENV_MKLROOT}/lib/ia32")
+        endif()
       endif()
       if (WIN32)
-	string(REPLACE ":" ";" _libdir2 "$ENV{LIB}")
+        string(REPLACE ":" ";" _libdir2 "$ENV{LIB}")
       elseif (APPLE)
-	string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}")
+        string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}")
       else ()
-	string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}")
+        string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}")
       endif ()
       list(APPEND _libdir "${_libdir2}")
       list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
@@ -243,30 +243,29 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
 
     if(_libraries_work)
       if (BLA_STATIC)
-	if (WIN32)
-	  set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
-	endif ()
-	if (APPLE)
-	  set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
-	else ()
-	  set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
-	endif ()
+        if (WIN32)
+          set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+        endif ()
+        if (APPLE)
+          set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+        else ()
+          set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+        endif ()
       else ()
-	if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
-	  # for ubuntu's libblas3gf and liblapack3gf packages
-	  set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
-	endif ()
+        if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+          # for ubuntu's libblas3gf and liblapack3gf packages
+          set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
+        endif ()
       endif ()
       find_library(${_prefix}_${_library}_LIBRARY
-	NAMES ${_library}
-	HINTS ${_libdir}
-	NO_DEFAULT_PATH
-	)
+        NAMES ${_library}
+        HINTS ${_libdir}
+        )
       mark_as_advanced(${_prefix}_${_library}_LIBRARY)
       # Print status if not found
       # -------------------------
       if (NOT ${_prefix}_${_library}_LIBRARY AND NOT BLAS_FIND_QUIETLY AND BLAS_VERBOSE)
-	Print_Find_Library_Blas_Status(blas ${_library} ${_libdir})
+        Print_Find_Library_Blas_Status(blas ${_library} ${_libdir})
       endif ()
       set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
       set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
@@ -283,16 +282,16 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
     set(CMAKE_REQUIRED_FLAGS "${BLAS_COMPILER_FLAGS}")
     if (BLAS_VERBOSE)
       message("${Cyan}BLAS libs found for BLA_VENDOR ${BLA_VENDOR}."
-	"Try to compile symbol ${_name} with following libraries:"
-	"${CMAKE_REQUIRED_LIBRARIES}")
+        "Try to compile symbol ${_name} with following libraries:"
+        "${CMAKE_REQUIRED_LIBRARIES}")
     endif ()
     if(NOT BLAS_FOUND)
       unset(${_prefix}${_combined_name}_WORKS CACHE)
     endif()
     if (_CHECK_FORTRAN)
       if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
-	string(REPLACE "mkl_intel_lp64" "mkl_gf_lp64" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
-	string(REPLACE "mkl_intel_ilp64" "mkl_gf_ilp64" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
+        string(REPLACE "mkl_intel_lp64" "mkl_gf_lp64" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
+        string(REPLACE "mkl_intel_ilp64" "mkl_gf_ilp64" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
       endif()
       check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
     else()
@@ -348,21 +347,21 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
       list(APPEND _inc_env "${ENV_BLAS_DIR}/include")
     else()
       if (ENV_MKLROOT)
-	list(APPEND _inc_env "${ENV_MKLROOT}/include")
+        list(APPEND _inc_env "${ENV_MKLROOT}/include")
       endif()
       # system variables
       if(WIN32)
-	string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
-	list(APPEND _inc_env "${_path_env}")
+        string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
+        list(APPEND _inc_env "${_path_env}")
       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}")
+        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}")
@@ -378,20 +377,20 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
     if(BLAS_INCDIR)
       set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND")
       find_path(BLAS_mkl.h_DIRS
-	NAMES mkl.h
-	HINTS ${BLAS_INCDIR})
+        NAMES mkl.h
+        HINTS ${BLAS_INCDIR})
     else()
       if(BLAS_DIR)
-	set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND")
-	find_path(BLAS_mkl.h_DIRS
-	  NAMES mkl.h
-	  HINTS ${BLAS_DIR}
-	  PATH_SUFFIXES "include")
+        set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND")
+        find_path(BLAS_mkl.h_DIRS
+          NAMES mkl.h
+          HINTS ${BLAS_DIR}
+          PATH_SUFFIXES "include")
       else()
-	set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND")
-	find_path(BLAS_mkl.h_DIRS
-	  NAMES mkl.h
-	  HINTS ${PATH_TO_LOOK_FOR})
+        set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND")
+        find_path(BLAS_mkl.h_DIRS
+          NAMES mkl.h
+          HINTS ${PATH_TO_LOOK_FOR})
       endif()
     endif()
     mark_as_advanced(BLAS_mkl.h_DIRS)
@@ -403,7 +402,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
     else ()
       set(BLAS_INCLUDE_DIRS "BLAS_INCLUDE_DIRS-NOTFOUND")
       if(NOT BLAS_FIND_QUIETLY)
-	message(STATUS "Looking for BLAS -- mkl.h not found")
+        message(STATUS "Looking for BLAS -- mkl.h not found")
       endif()
     endif()
 
@@ -436,257 +435,257 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
     # choose one or another depending on the compilo
     if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
       if (OMP_gomp_LIBRARY)
-	set(OMP_LIB "${OMP_gomp_LIBRARY}")
+        set(OMP_LIB "${OMP_gomp_LIBRARY}")
       endif()
     else(CMAKE_C_COMPILER_ID STREQUAL "Intel")
       if (OMP_iomp5_LIBRARY)
-	set(OMP_LIB "${OMP_iomp5_LIBRARY}")
+        set(OMP_LIB "${OMP_iomp5_LIBRARY}")
       endif()
     endif()
 
     if (UNIX AND NOT WIN32)
       # m
       find_library(M_LIBRARY
-	NAMES m
-	HINTS ${_libdir})
+        NAMES m
+        HINTS ${_libdir})
       mark_as_advanced(M_LIBRARY)
       if(M_LIBRARY)
-	set(LM "-lm")
+        set(LM "-lm")
       else()
-	set(LM "")
+        set(LM "")
       endif()
       # Fortran
       set(LGFORTRAN "")
       if (CMAKE_C_COMPILER_ID MATCHES "GNU")
-	find_library(
-	  FORTRAN_gfortran_LIBRARY
-	  NAMES gfortran
-	  HINTS ${_libdir}
-	  )
-	mark_as_advanced(FORTRAN_gfortran_LIBRARY)
-	if (FORTRAN_gfortran_LIBRARY)
-	  set(LGFORTRAN "${FORTRAN_gfortran_LIBRARY}")
-	endif()
+        find_library(
+          FORTRAN_gfortran_LIBRARY
+          NAMES gfortran
+          HINTS ${_libdir}
+          )
+        mark_as_advanced(FORTRAN_gfortran_LIBRARY)
+        if (FORTRAN_gfortran_LIBRARY)
+          set(LGFORTRAN "${FORTRAN_gfortran_LIBRARY}")
+        endif()
       elseif (CMAKE_C_COMPILER_ID MATCHES "Intel")
-	find_library(
-	  FORTRAN_ifcore_LIBRARY
-	  NAMES ifcore
-	  HINTS ${_libdir}
-	  )
-	mark_as_advanced(FORTRAN_ifcore_LIBRARY)
-	if (FORTRAN_ifcore_LIBRARY)
-	  set(LGFORTRAN "{FORTRAN_ifcore_LIBRARY}")
-	endif()
+        find_library(
+          FORTRAN_ifcore_LIBRARY
+          NAMES ifcore
+          HINTS ${_libdir}
+          )
+        mark_as_advanced(FORTRAN_ifcore_LIBRARY)
+        if (FORTRAN_ifcore_LIBRARY)
+          set(LGFORTRAN "{FORTRAN_ifcore_LIBRARY}")
+        endif()
       endif()
       set(BLAS_COMPILER_FLAGS "")
       if (NOT BLA_VENDOR STREQUAL "Intel10_64lp_seq")
-	if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
-	  list(APPEND BLAS_COMPILER_FLAGS "-openmp")
-	endif()
-	if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
-	  list(APPEND BLAS_COMPILER_FLAGS "-fopenmp")
-	endif()
+        if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
+          list(APPEND BLAS_COMPILER_FLAGS "-openmp")
+        endif()
+        if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+          list(APPEND BLAS_COMPILER_FLAGS "-fopenmp")
+        endif()
       endif()
       if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
-	if (BLA_VENDOR STREQUAL "Intel10_32")
-	  list(APPEND BLAS_COMPILER_FLAGS "-m32")
-	else()
-	  list(APPEND BLAS_COMPILER_FLAGS "-m64")
-	endif()
-	if (NOT BLA_VENDOR STREQUAL "Intel10_64lp_seq")
-	  list(APPEND OMP_LIB "-ldl")
-	endif()
-	if (ENV_MKLROOT)
-	  list(APPEND BLAS_COMPILER_FLAGS "-I${ENV_MKLROOT}/include")
-	endif()
+        if (BLA_VENDOR STREQUAL "Intel10_32")
+          list(APPEND BLAS_COMPILER_FLAGS "-m32")
+        else()
+          list(APPEND BLAS_COMPILER_FLAGS "-m64")
+        endif()
+        if (NOT BLA_VENDOR STREQUAL "Intel10_64lp_seq")
+          list(APPEND OMP_LIB "-ldl")
+        endif()
+        if (ENV_MKLROOT)
+          list(APPEND BLAS_COMPILER_FLAGS "-I${ENV_MKLROOT}/include")
+        endif()
       endif()
 
       set(additional_flags "")
       if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
-	set(additional_flags "-Wl,--no-as-needed")
+        set(additional_flags "-Wl,--no-as-needed")
       endif()
     endif ()
 
     if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
       if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
-	find_package(Threads)
+        find_package(Threads)
       else()
-	find_package(Threads REQUIRED)
+        find_package(Threads REQUIRED)
       endif()
 
       set(BLAS_SEARCH_LIBS "")
 
       if(BLA_F95)
 
-	set(BLAS_mkl_SEARCH_SYMBOL SGEMM)
-	set(_LIBRARIES BLAS95_LIBRARIES)
-	if (WIN32)
-	  if (BLA_STATIC)
-	    set(BLAS_mkl_DLL_SUFFIX "")
-	  else()
-	    set(BLAS_mkl_DLL_SUFFIX "_dll")
-	  endif()
-
-	  # Find the main file (32-bit or 64-bit)
-	  set(BLAS_SEARCH_LIBS_WIN_MAIN "")
-	  if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
-	    list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
-	      "mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
-	  endif()
-	  if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All")
-	    list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
-	      "mkl_blas95_lp64${BLAS_mkl_DLL_SUFFIX} mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")
-	  endif ()
-
-	  # Add threading/sequential libs
-	  set(BLAS_SEARCH_LIBS_WIN_THREAD "")
-	  if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
-	    list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
-	      "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
-	  endif()
-	  if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
-	    # old version
-	    list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
-	      "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
-	    # mkl >= 10.3
-	    list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
-	      "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
-	  endif()
-
-	  # Cartesian product of the above
-	  foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
-	    foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
-	      list(APPEND BLAS_SEARCH_LIBS
-		"${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
-	    endforeach()
-	  endforeach()
-	else (WIN32)
-	  if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
-	    list(APPEND BLAS_SEARCH_LIBS
-	      "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide")
-	  endif ()
-	  if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
-	    # old version
-	    list(APPEND BLAS_SEARCH_LIBS
-	      "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide")
-	    # mkl >= 10.3
-	    if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
-	      list(APPEND BLAS_SEARCH_LIBS
-		"mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core")
-	    endif()
-	    if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
-	      list(APPEND BLAS_SEARCH_LIBS
-		"mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core")
-	    endif()
-	  endif ()
-	  if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
-	    list(APPEND BLAS_SEARCH_LIBS
-	      "mkl_intel_lp64 mkl_sequential mkl_core")
-	    if (BLA_VENDOR STREQUAL "Intel10_64lp_seq")
-	      set(OMP_LIB "")
-	    endif()
-	  endif ()
-	endif (WIN32)
+        set(BLAS_mkl_SEARCH_SYMBOL SGEMM)
+        set(_LIBRARIES BLAS95_LIBRARIES)
+        if (WIN32)
+          if (BLA_STATIC)
+            set(BLAS_mkl_DLL_SUFFIX "")
+          else()
+            set(BLAS_mkl_DLL_SUFFIX "_dll")
+          endif()
+
+          # Find the main file (32-bit or 64-bit)
+          set(BLAS_SEARCH_LIBS_WIN_MAIN "")
+          if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+              "mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
+          endif()
+          if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+              "mkl_blas95_lp64${BLAS_mkl_DLL_SUFFIX} mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")
+          endif ()
+
+          # Add threading/sequential libs
+          set(BLAS_SEARCH_LIBS_WIN_THREAD "")
+          if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+              "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
+          endif()
+          if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
+            # old version
+            list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+              "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+            # mkl >= 10.3
+            list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+              "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+          endif()
+
+          # Cartesian product of the above
+          foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
+            foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
+              list(APPEND BLAS_SEARCH_LIBS
+                "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
+            endforeach()
+          endforeach()
+        else (WIN32)
+          if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide")
+          endif ()
+          if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
+            # old version
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide")
+            # mkl >= 10.3
+            if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
+              list(APPEND BLAS_SEARCH_LIBS
+                "mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core")
+            endif()
+            if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+              list(APPEND BLAS_SEARCH_LIBS
+                "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core")
+            endif()
+          endif ()
+          if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_intel_lp64 mkl_sequential mkl_core")
+            if (BLA_VENDOR STREQUAL "Intel10_64lp_seq")
+              set(OMP_LIB "")
+            endif()
+          endif ()
+        endif (WIN32)
 
       else (BLA_F95)
 
-	set(BLAS_mkl_SEARCH_SYMBOL sgemm)
-	set(_LIBRARIES BLAS_LIBRARIES)
-	if (WIN32)
-	  if (BLA_STATIC)
-	    set(BLAS_mkl_DLL_SUFFIX "")
-	  else()
-	    set(BLAS_mkl_DLL_SUFFIX "_dll")
-	  endif()
-
-	  # Find the main file (32-bit or 64-bit)
-	  set(BLAS_SEARCH_LIBS_WIN_MAIN "")
-	  if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
-	    list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
-	      "mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
-	  endif()
-	  if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All")
-	    list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
-	      "mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")
-	  endif ()
-
-	  # Add threading/sequential libs
-	  set(BLAS_SEARCH_LIBS_WIN_THREAD "")
-	  if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
-	    # old version
-	    list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
-	      "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
-	    # mkl >= 10.3
-	    list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
-	      "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
-	  endif()
-	  if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
-	    list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
-	      "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
-	  endif()
-
-	  # Cartesian product of the above
-	  foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
-	    foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
-	      list(APPEND BLAS_SEARCH_LIBS
-		"${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
-	    endforeach()
-	  endforeach()
-	else (WIN32)
-	  if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
-	    list(APPEND BLAS_SEARCH_LIBS
-	      "mkl_intel mkl_intel_thread mkl_core guide")
-	  endif ()
-	  if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
-	    # old version
-	    list(APPEND BLAS_SEARCH_LIBS
-	      "mkl_intel_lp64 mkl_intel_thread mkl_core guide")
-	    # mkl >= 10.3
-	    if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
-	      list(APPEND BLAS_SEARCH_LIBS
-		"mkl_intel_lp64 mkl_intel_thread mkl_core")
-	    endif()
-	    if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
-	      list(APPEND BLAS_SEARCH_LIBS
-		"mkl_intel_lp64 mkl_gnu_thread mkl_core")
-	    endif()
-	  endif ()
-	  if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
-	    list(APPEND BLAS_SEARCH_LIBS
-	      "mkl_intel_lp64 mkl_sequential mkl_core")
-	    if (BLA_VENDOR STREQUAL "Intel10_64lp_seq")
-	      set(OMP_LIB "")
-	    endif()
-	  endif ()
-	  #older vesions of intel mkl libs
-	  if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")
-	    list(APPEND BLAS_SEARCH_LIBS
-	      "mkl")
-	    list(APPEND BLAS_SEARCH_LIBS
-	      "mkl_ia32")
-	    list(APPEND BLAS_SEARCH_LIBS
-	      "mkl_em64t")
-	  endif ()
-	endif (WIN32)
+        set(BLAS_mkl_SEARCH_SYMBOL sgemm)
+        set(_LIBRARIES BLAS_LIBRARIES)
+        if (WIN32)
+          if (BLA_STATIC)
+            set(BLAS_mkl_DLL_SUFFIX "")
+          else()
+            set(BLAS_mkl_DLL_SUFFIX "_dll")
+          endif()
+
+          # Find the main file (32-bit or 64-bit)
+          set(BLAS_SEARCH_LIBS_WIN_MAIN "")
+          if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+              "mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
+          endif()
+          if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+              "mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")
+          endif ()
+
+          # Add threading/sequential libs
+          set(BLAS_SEARCH_LIBS_WIN_THREAD "")
+          if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
+            # old version
+            list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+              "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+            # mkl >= 10.3
+            list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+              "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+          endif()
+          if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+              "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
+          endif()
+
+          # Cartesian product of the above
+          foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
+            foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
+              list(APPEND BLAS_SEARCH_LIBS
+                "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
+            endforeach()
+          endforeach()
+        else (WIN32)
+          if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_intel mkl_intel_thread mkl_core guide")
+          endif ()
+          if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
+            # old version
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_intel_lp64 mkl_intel_thread mkl_core guide")
+            # mkl >= 10.3
+            if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
+              list(APPEND BLAS_SEARCH_LIBS
+                "mkl_intel_lp64 mkl_intel_thread mkl_core")
+            endif()
+            if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+              list(APPEND BLAS_SEARCH_LIBS
+                "mkl_intel_lp64 mkl_gnu_thread mkl_core")
+            endif()
+          endif ()
+          if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_intel_lp64 mkl_sequential mkl_core")
+            if (BLA_VENDOR STREQUAL "Intel10_64lp_seq")
+              set(OMP_LIB "")
+            endif()
+          endif ()
+          #older vesions of intel mkl libs
+          if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl")
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_ia32")
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_em64t")
+          endif ()
+        endif (WIN32)
 
       endif (BLA_F95)
 
       foreach (IT ${BLAS_SEARCH_LIBS})
-	string(REPLACE " " ";" SEARCH_LIBS ${IT})
-	if (${_LIBRARIES})
-	else ()
-	  check_fortran_libraries(
-	    ${_LIBRARIES}
-	    BLAS
-	    ${BLAS_mkl_SEARCH_SYMBOL}
-	    "${additional_flags}"
-	    "${SEARCH_LIBS}"
-	    "${OMP_LIB};${CMAKE_THREAD_LIBS_INIT};${LM}"
-	    )
-	  if(_LIBRARIES)
-	    set(BLAS_LINKER_FLAGS "${additional_flags}")
-	  endif()
-	endif()
+        string(REPLACE " " ";" SEARCH_LIBS ${IT})
+        if (${_LIBRARIES})
+        else ()
+          check_fortran_libraries(
+            ${_LIBRARIES}
+            BLAS
+            ${BLAS_mkl_SEARCH_SYMBOL}
+            "${additional_flags}"
+            "${SEARCH_LIBS}"
+            "${OMP_LIB};${CMAKE_THREAD_LIBS_INIT};${LM}"
+            )
+          if(_LIBRARIES)
+            set(BLAS_LINKER_FLAGS "${additional_flags}")
+          endif()
+        endif()
       endforeach ()
       if(NOT BLAS_FIND_QUIETLY)
         if(${_LIBRARIES})
@@ -717,9 +716,9 @@ if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for Goto BLAS: found")
+        message(STATUS "Looking for Goto BLAS: found")
       else()
-	message(STATUS "Looking for Goto BLAS: not found")
+        message(STATUS "Looking for Goto BLAS: not found")
       endif()
     endif()
   endif()
@@ -745,9 +744,9 @@ if (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for Open BLAS: found")
+        message(STATUS "Looking for Open BLAS: found")
       else()
-	message(STATUS "Looking for Open BLAS: not found")
+        message(STATUS "Looking for Open BLAS: not found")
       endif()
     endif()
   endif()
@@ -773,9 +772,9 @@ if (BLA_VENDOR STREQUAL "Eigen" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
-	message(STATUS "Looking for Eigen BLAS: found")
+        message(STATUS "Looking for Eigen BLAS: found")
       else()
-	message(STATUS "Looking for Eigen BLAS: not found")
+        message(STATUS "Looking for Eigen BLAS: not found")
       endif()
     endif()
   endif()
@@ -792,9 +791,9 @@ if (BLA_VENDOR STREQUAL "Eigen" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for Eigen BLAS: found")
+        message(STATUS "Looking for Eigen BLAS: found")
       else()
-	message(STATUS "Looking for Eigen BLAS: not found")
+        message(STATUS "Looking for Eigen BLAS: not found")
       endif()
     endif()
   endif()
@@ -819,9 +818,9 @@ if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for Atlas BLAS: found")
+        message(STATUS "Looking for Atlas BLAS: found")
       else()
-	message(STATUS "Looking for Atlas BLAS: not found")
+        message(STATUS "Looking for Atlas BLAS: not found")
       endif()
     endif()
   endif()
@@ -847,9 +846,9 @@ if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for PhiPACK BLAS: found")
+        message(STATUS "Looking for PhiPACK BLAS: found")
       else()
-	message(STATUS "Looking for PhiPACK BLAS: not found")
+        message(STATUS "Looking for PhiPACK BLAS: not found")
       endif()
     endif()
   endif()
@@ -875,9 +874,9 @@ if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for CXML BLAS: found")
+        message(STATUS "Looking for CXML BLAS: found")
       else()
-	message(STATUS "Looking for CXML BLAS: not found")
+        message(STATUS "Looking for CXML BLAS: not found")
       endif()
     endif()
   endif()
@@ -903,9 +902,9 @@ if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for DXML BLAS: found")
+        message(STATUS "Looking for DXML BLAS: found")
       else()
-	message(STATUS "Looking for DXML BLAS: not found")
+        message(STATUS "Looking for DXML BLAS: not found")
       endif()
     endif()
   endif()
@@ -913,7 +912,7 @@ if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
   if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
       set (BLAS_VENDOR_FOUND "DXML")
   endif()
-  
+
 endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
 
 
@@ -934,9 +933,9 @@ if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
     endif()
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for SunPerf BLAS: found")
+        message(STATUS "Looking for SunPerf BLAS: found")
       else()
-	message(STATUS "Looking for SunPerf BLAS: not found")
+        message(STATUS "Looking for SunPerf BLAS: not found")
       endif()
     endif()
   endif()
@@ -962,9 +961,9 @@ if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for SCSL BLAS: found")
+        message(STATUS "Looking for SCSL BLAS: found")
       else()
-	message(STATUS "Looking for SCSL BLAS: not found")
+        message(STATUS "Looking for SCSL BLAS: not found")
       endif()
     endif()
   endif()
@@ -990,9 +989,9 @@ if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for SGIMATH BLAS: found")
+        message(STATUS "Looking for SGIMATH BLAS: found")
       else()
-	message(STATUS "Looking for SGIMATH BLAS: not found")
+        message(STATUS "Looking for SGIMATH BLAS: not found")
       endif()
     endif()
   endif()
@@ -1018,9 +1017,9 @@ if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for IBM ESSL BLAS: found")
+        message(STATUS "Looking for IBM ESSL BLAS: found")
       else()
-	message(STATUS "Looking for IBM ESSL BLAS: not found")
+        message(STATUS "Looking for IBM ESSL BLAS: not found")
       endif()
     endif()
   endif()
@@ -1045,9 +1044,9 @@ if (BLA_VENDOR STREQUAL "IBMESSLMT" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for IBM ESSL MT BLAS: found")
+        message(STATUS "Looking for IBM ESSL MT BLAS: found")
       else()
-	message(STATUS "Looking for IBM ESSL MT BLAS: not found")
+        message(STATUS "Looking for IBM ESSL MT BLAS: not found")
       endif()
     endif()
   endif()
@@ -1084,44 +1083,44 @@ if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
 
       get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH )
       if( SIZEOF_INTEGER EQUAL 8 )
-	set( _ACML_PATH_SUFFIX "_int64" )
+        set( _ACML_PATH_SUFFIX "_int64" )
       else()
-	set( _ACML_PATH_SUFFIX "" )
+        set( _ACML_PATH_SUFFIX "" )
       endif()
       if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
-	set( _ACML_COMPILER32 "ifort32" )
-	set( _ACML_COMPILER64 "ifort64" )
+        set( _ACML_COMPILER32 "ifort32" )
+        set( _ACML_COMPILER64 "ifort64" )
       elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" )
-	set( _ACML_COMPILER32 "sun32" )
-	set( _ACML_COMPILER64 "sun64" )
+        set( _ACML_COMPILER32 "sun32" )
+        set( _ACML_COMPILER64 "sun64" )
       elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
-	set( _ACML_COMPILER32 "pgi32" )
-	if( WIN32 )
-	  set( _ACML_COMPILER64 "win64" )
-	else()
-	  set( _ACML_COMPILER64 "pgi64" )
-	endif()
+        set( _ACML_COMPILER32 "pgi32" )
+        if( WIN32 )
+          set( _ACML_COMPILER64 "win64" )
+        else()
+          set( _ACML_COMPILER64 "pgi64" )
+        endif()
       elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" )
-	# 32 bit builds not supported on Open64 but for code simplicity
-	# We'll just use the same directory twice
-	set( _ACML_COMPILER32 "open64_64" )
-	set( _ACML_COMPILER64 "open64_64" )
+        # 32 bit builds not supported on Open64 but for code simplicity
+        # We'll just use the same directory twice
+        set( _ACML_COMPILER32 "open64_64" )
+        set( _ACML_COMPILER64 "open64_64" )
       elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" )
-	set( _ACML_COMPILER32 "nag32" )
-	set( _ACML_COMPILER64 "nag64" )
+        set( _ACML_COMPILER32 "nag32" )
+        set( _ACML_COMPILER64 "nag64" )
       else()
-	set( _ACML_COMPILER32 "gfortran32" )
-	set( _ACML_COMPILER64 "gfortran64" )
+        set( _ACML_COMPILER32 "gfortran32" )
+        set( _ACML_COMPILER64 "gfortran64" )
       endif()
 
       if( BLA_VENDOR STREQUAL "ACML_MP" )
-	set(_ACML_MP_LIB_DIRS
-	  "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"
-	  "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" )
+        set(_ACML_MP_LIB_DIRS
+          "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"
+          "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" )
       else()
-	set(_ACML_LIB_DIRS
-	  "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"
-	  "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" )
+        set(_ACML_LIB_DIRS
+          "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"
+          "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" )
       endif()
 
     endif(_ACML_ROOT)
@@ -1135,37 +1134,37 @@ if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
   if( BLA_VENDOR STREQUAL "ACML_MP" )
     foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS})
       check_fortran_libraries (
-	BLAS_LIBRARIES
-	BLAS
-	sgemm
-	"" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS}
-	)
+        BLAS_LIBRARIES
+        BLAS
+        sgemm
+        "" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS}
+        )
       if( BLAS_LIBRARIES )
-	break()
+        break()
       endif()
     endforeach()
   elseif( BLA_VENDOR STREQUAL "ACML_GPU" )
     foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS})
       check_fortran_libraries (
-	BLAS_LIBRARIES
-	BLAS
-	sgemm
-	"" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS}
-	)
+        BLAS_LIBRARIES
+        BLAS
+        sgemm
+        "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS}
+        )
       if( BLAS_LIBRARIES )
-	break()
+        break()
       endif()
     endforeach()
   else()
     foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} )
       check_fortran_libraries (
-	BLAS_LIBRARIES
-	BLAS
-	sgemm
-	"" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS}
-	)
+        BLAS_LIBRARIES
+        BLAS
+        sgemm
+        "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS}
+        )
       if( BLAS_LIBRARIES )
-	break()
+        break()
       endif()
     endforeach()
   endif()
@@ -1182,9 +1181,9 @@ if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for ACML BLAS: found")
+        message(STATUS "Looking for ACML BLAS: found")
       else()
-	message(STATUS "Looking for ACML BLAS: not found")
+        message(STATUS "Looking for ACML BLAS: not found")
       endif()
     endif()
   endif()
@@ -1200,9 +1199,9 @@ if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for ACML BLAS: found")
+        message(STATUS "Looking for ACML BLAS: found")
       else()
-	message(STATUS "Looking for ACML BLAS: not found")
+        message(STATUS "Looking for ACML BLAS: not found")
       endif()
     endif()
   endif()
@@ -1218,9 +1217,9 @@ if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for ACML BLAS: found")
+        message(STATUS "Looking for ACML BLAS: found")
       else()
-	message(STATUS "Looking for ACML BLAS: not found")
+        message(STATUS "Looking for ACML BLAS: not found")
       endif()
     endif()
   endif()
@@ -1246,9 +1245,9 @@ if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for Apple BLAS: found")
+        message(STATUS "Looking for Apple BLAS: found")
       else()
-	message(STATUS "Looking for Apple BLAS: not found")
+        message(STATUS "Looking for Apple BLAS: not found")
       endif()
     endif()
   endif()
@@ -1273,9 +1272,9 @@ if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
       )
     if(NOT BLAS_FIND_QUIETLY)
       if(BLAS_LIBRARIES)
-	message(STATUS "Looking for NAS BLAS: found")
+        message(STATUS "Looking for NAS BLAS: found")
       else()
-	message(STATUS "Looking for NAS BLAS: not found")
+        message(STATUS "Looking for NAS BLAS: not found")
       endif()
     endif()
   endif ()
@@ -1295,19 +1294,19 @@ if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
     if (BLAS_LIBRARIES)
     else ()
       check_fortran_libraries(
-	BLAS_LIBRARIES
-	BLAS
-	sgemm
-	""
-	"${SEARCH_LIB}"
-	"${LGFORTRAN}"
-	)
+        BLAS_LIBRARIES
+        BLAS
+        sgemm
+        ""
+        "${SEARCH_LIB}"
+        "${LGFORTRAN}"
+        )
       if(NOT BLAS_FIND_QUIETLY)
-	if(BLAS_LIBRARIES)
-	  message(STATUS "Looking for Generic BLAS: found")
-	else()
-	  message(STATUS "Looking for Generic BLAS: not found")
-	endif()
+        if(BLAS_LIBRARIES)
+          message(STATUS "Looking for Generic BLAS: found")
+        else()
+          message(STATUS "Looking for Generic BLAS: not found")
+        endif()
       endif()
     endif()
   endforeach ()
@@ -1333,32 +1332,38 @@ if(BLA_F95)
       message(STATUS "BLAS_LIBRARIES ${BLAS_LIBRARIES}")
     else(BLAS95_FOUND)
       message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but blas 95 libraries could not be found or check of symbols failed."
-	"\nPlease indicate where to find blas libraries. You have three options:\n"
-	"- Option 1: Provide the installation directory of BLAS library with cmake option: -DBLAS_DIR=your/path/to/blas\n"
-	"- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
-	"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
-	"\nTo follow libraries detection more precisely you can activate a verbose mode with -DBLAS_VERBOSE=ON at cmake configure."
-	"\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."
-	"\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"
-	"Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
-	"Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
+        "\nPlease indicate where to find blas libraries. You have three options:\n"
+        "- Option 1: Provide the installation directory of BLAS library with cmake option: -DBLAS_DIR=your/path/to/blas\n"
+        "- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
+        "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
+        "\nTo follow libraries detection more precisely you can activate a verbose mode with -DBLAS_VERBOSE=ON at cmake configure."
+        "\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."
+        "\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"
+        "Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
+        "Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
       if(BLAS_FIND_REQUIRED)
-	message(FATAL_ERROR
-	  "A required library with BLAS95 API not found. Please specify library location.")
+        message(FATAL_ERROR
+          "A required library with BLAS95 API not found. Please specify library location.")
       else()
-	message(STATUS
-	  "A library with BLAS95 API not found. Please specify library location.")
+        message(STATUS
+          "A library with BLAS95 API not found. Please specify library location.")
       endif()
     endif(BLAS95_FOUND)
   endif(NOT BLAS_FIND_QUIETLY)
 
   set(BLAS_FOUND TRUE)
   set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
+  if (NOT BLAS_LIBRARIES_DEP)
+    set(BLAS_LIBRARIES_DEP "${BLAS95_LIBRARIES}")
+  endif()
 
 else(BLA_F95)
 
   if(BLAS_LIBRARIES)
     set(BLAS_FOUND TRUE)
+    if (NOT BLAS_LIBRARIES_DEP)
+      set(BLAS_LIBRARIES_DEP "${BLAS_LIBRARIES}")
+    endif()
   else()
     set(BLAS_FOUND FALSE)
   endif()
@@ -1369,21 +1374,21 @@ else(BLA_F95)
       message(STATUS "BLAS_LIBRARIES ${BLAS_LIBRARIES}")
     else(BLAS_FOUND)
       message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but blas libraries could not be found or check of symbols failed."
-	"\nPlease indicate where to find blas libraries. You have three options:\n"
-	"- Option 1: Provide the installation directory of BLAS library with cmake option: -DBLAS_DIR=your/path/to/blas\n"
-	"- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
-	"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
-	"\nTo follow libraries detection more precisely you can activate a verbose mode with -DBLAS_VERBOSE=ON at cmake configure."
-	"\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."
-	"\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"
-	"Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
-	"Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
+        "\nPlease indicate where to find blas libraries. You have three options:\n"
+        "- Option 1: Provide the installation directory of BLAS library with cmake option: -DBLAS_DIR=your/path/to/blas\n"
+        "- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
+        "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
+        "\nTo follow libraries detection more precisely you can activate a verbose mode with -DBLAS_VERBOSE=ON at cmake configure."
+        "\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."
+        "\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"
+        "Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
+        "Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
       if(BLAS_FIND_REQUIRED)
-	message(FATAL_ERROR
-	  "A required library with BLAS API not found. Please specify library location.")
+        message(FATAL_ERROR
+          "A required library with BLAS API not found. Please specify library location.")
       else()
-	message(STATUS
-	  "A library with BLAS API not found. Please specify library location.")
+        message(STATUS
+          "A library with BLAS API not found. Please specify library location.")
       endif()
     endif(BLAS_FOUND)
   endif(NOT BLAS_FIND_QUIETLY)
diff --git a/modules/find/FindBLASEXT.cmake b/modules/find/FindBLASEXT.cmake
index 0fe7fb84931bacf4f7879be412c6abf37c44d175..a12a199983db4fa00a888570f3ac06595d74e22b 100644
--- a/modules/find/FindBLASEXT.cmake
+++ b/modules/find/FindBLASEXT.cmake
@@ -3,7 +3,7 @@
 # @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-2017 Inria. All rights reserved.
 # @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
 #
 ###
@@ -18,17 +18,27 @@
 #
 # The following variables have been added to manage links with sequential or multithreaded
 # versions:
-#  BLAS_INCLUDE_DIRS  - BLAS include directories
-#  BLAS_LIBRARY_DIRS  - Link directories for BLAS libraries
-#  BLAS_SEQ_LIBRARIES - BLAS component libraries to be linked (sequential)
-#  BLAS_PAR_LIBRARIES - BLAS component libraries to be linked (multithreaded)
+#  BLAS_INCLUDE_DIRS       - BLAS include directories
+#  BLAS_LIBRARY_DIRS       - Link directories for BLAS libraries
+#  BLAS_SEQ_LIBRARIES      - BLAS component libraries to be linked (sequential)
+#  BLAS_SEQ_COMPILER_FLAGS - uncached list of required compiler flags (including -I for mkl headers).
+#  BLAS_SEQ_LINKER_FLAGS   - uncached list of required linker flags (excluding -l
+#    and -L)
+#  BLAS_PAR_LIBRARIES      - BLAS component libraries to be linked (multithreaded)
+#  BLAS_PAR_COMPILER_FLAGS - uncached list of required compiler flags (including -I for mkl headers)
+#  BLAS_PAR_LINKER_FLAGS   - uncached list of required linker flags (excluding -l
+#    and -L)
+#  BLASEXT_FOUND           - if a BLAS has been found
+#  BLASEXT_LIBRARIES       - Idem BLAS_LIBRARIES
+#  BLASEXT_INCLUDE_DIRS    - Idem BLAS_INCLUDE_DIRS
+#  BLASEXT_LIBRARY_DIRS    - Idem BLAS_LIBRARY_DIRS
 
 #=============================================================================
 # Copyright 2012-2013 Inria
 # Copyright 2012-2013 Emmanuel Agullo
 # Copyright 2012-2013 Mathieu Faverge
 # Copyright 2012      Cedric Castagnede
-# Copyright 2013-2016 Florent Pruvost
+# Copyright 2013-2017 Florent Pruvost
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file MORSE-Copyright.txt for details.
@@ -40,9 +50,10 @@
 # (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)
+# Macro to factorize this call. required arguments allows to decide if
+# the REQUIRED option must be given to find_package calls
+macro(find_package_blas required)
+  if(BLASEXT_FIND_REQUIRED AND required)
     if(BLASEXT_FIND_QUIETLY)
       find_package(BLAS REQUIRED QUIET)
     else()
@@ -80,10 +91,9 @@ if(NOT BLASEXT_FIND_QUIETLY)
 endif()
 
 if (NOT BLAS_FOUND)
-  # First try to detect two cases:
-  # 1: only SEQ libs are handled
-  # 2: both SEQ and PAR libs are handled
-  find_package_blas()
+  # First blas detection in order to decide if we should look for a
+  # multitheaded version
+  find_package_blas(0)
 endif ()
 
 # detect the cases where SEQ and PAR libs are handled
@@ -161,14 +171,14 @@ if(BLA_VENDOR MATCHES "Intel*")
     if(BLAS_DIR)
       set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND")
       find_path(BLAS_mkl.h_INCLUDE_DIRS
-	NAMES mkl.h
-	HINTS ${BLAS_DIR}
-	PATH_SUFFIXES include)
+        NAMES mkl.h
+        HINTS ${BLAS_DIR}
+        PATH_SUFFIXES include)
     else()
       set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND")
       find_path(BLAS_mkl.h_INCLUDE_DIRS
-	NAMES mkl.h
-	HINTS ${_inc_env})
+        NAMES mkl.h
+        HINTS ${_inc_env})
     endif()
   endif()
   mark_as_advanced(BLAS_mkl.h_INCLUDE_DIRS)
@@ -193,9 +203,15 @@ if(BLA_VENDOR MATCHES "Intel*")
     if(NOT BLASEXT_FIND_QUIETLY)
       message(STATUS "Look for the sequential version Intel10_64lp_seq")
     endif()
-    find_package_blas()
+    find_package_blas(0)
     if(BLAS_FOUND)
       set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
+      if (BLAS_COMPILER_FLAGS)
+        set (BLAS_SEQ_COMPILER_FLAGS "${BLAS_COMPILER_FLAGS}")
+      endif()
+      if (BLAS_LINKER_FLAGS)
+        set (BLAS_SEQ_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
+      endif()
     else()
       set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")
     endif()
@@ -205,9 +221,15 @@ 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(0)
     if(BLAS_FOUND)
       set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")
+      if (BLAS_COMPILER_FLAGS)
+        set (BLAS_PAR_COMPILER_FLAGS "${BLAS_COMPILER_FLAGS}")
+      endif()
+      if (BLAS_LINKER_FLAGS)
+        set (BLAS_PAR_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
+      endif()
     else()
       set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}")
     endif()
@@ -227,7 +249,7 @@ elseif(BLA_VENDOR MATCHES "ACML*")
 
   ## look for the sequential version
   set(BLA_VENDOR "ACML")
-  find_package_blas()
+  find_package_blas(0)
   if(BLAS_FOUND)
     set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
   else()
@@ -236,7 +258,7 @@ elseif(BLA_VENDOR MATCHES "ACML*")
 
   ## look for the multithreaded version
   set(BLA_VENDOR "ACML_MP")
-  find_package_blas()
+  find_package_blas(0)
   if(BLAS_FOUND)
     set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")
   else()
@@ -248,7 +270,7 @@ elseif(BLA_VENDOR MATCHES "IBMESSL*")
 
   ## look for the sequential version
   set(BLA_VENDOR "IBMESSL")
-  find_package_blas()
+  find_package_blas(0)
   if(BLAS_FOUND)
     set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
   else()
@@ -257,7 +279,7 @@ elseif(BLA_VENDOR MATCHES "IBMESSL*")
 
   ## look for the multithreaded version
   set(BLA_VENDOR "IBMESSLMT")
-  find_package_blas()
+  find_package_blas(0)
   if(BLAS_FOUND)
     set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")
   else()
@@ -276,9 +298,11 @@ else()
 
 endif()
 
-
+# Reset pure BLAS cmake variables to the sequential case (arbitrary default)
 if(BLAS_SEQ_LIBRARIES)
   set(BLAS_LIBRARIES "${BLAS_SEQ_LIBRARIES}")
+  set(BLAS_COMPILER_FLAGS "${BLAS_SEQ_COMPILER_FLAGS}")
+  set(BLAS_LINKER_FLAGS "${BLAS_SEQ_LINKER_FLAGS}")
 endif()
 
 # extract libs paths
@@ -296,7 +320,7 @@ foreach(blas_lib ${BLAS_LIBRARIES})
     else()
       get_filename_component(a_blas_lib_dir "${blas_lib}" PATH)
       if (EXISTS "${a_blas_lib_dir}")
-	list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" )
+        list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" )
       endif()
     endif()
   endif()
@@ -305,76 +329,70 @@ if (BLAS_LIBRARY_DIRS)
   list(REMOVE_DUPLICATES BLAS_LIBRARY_DIRS)
 endif ()
 
-# check that BLAS has been found
+# check that BLASEXT has been found
 # ---------------------------------
 include(FindPackageHandleStandardArgs)
 if(BLA_VENDOR MATCHES "Intel*")
-  if(BLA_VENDOR MATCHES "Intel10_64lp*")
-    if(NOT BLASEXT_FIND_QUIETLY)
-      message(STATUS "BLAS found is Intel MKL:"
-	"\n   we manage two lists of libs, one sequential and one parallel if found"
-	"\n   (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")
-      message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
-    endif()
-    find_package_handle_standard_args(BLAS DEFAULT_MSG
-      BLAS_SEQ_LIBRARIES
-      BLAS_LIBRARY_DIRS
-      BLAS_INCLUDE_DIRS)
-    if(BLAS_PAR_LIBRARIES)
-      if(NOT BLASEXT_FIND_QUIETLY)
-	message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES")
-      endif()
-      find_package_handle_standard_args(BLAS DEFAULT_MSG
-	BLAS_PAR_LIBRARIES)
-    endif()
-  else()
+  if(NOT BLASEXT_FIND_QUIETLY)
+    message(STATUS "BLAS found is Intel MKL")
+    message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
+  endif()
+  find_package_handle_standard_args(BLASEXT DEFAULT_MSG
+    BLAS_SEQ_LIBRARIES
+    BLAS_LIBRARY_DIRS
+    BLAS_INCLUDE_DIRS)
+  if(BLA_VENDOR MATCHES "Intel10_64lp*" AND BLAS_PAR_LIBRARIES)
     if(NOT BLASEXT_FIND_QUIETLY)
-      message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
+      message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES")
     endif()
-    find_package_handle_standard_args(BLAS DEFAULT_MSG
-      BLAS_SEQ_LIBRARIES
-      BLAS_LIBRARY_DIRS
-      BLAS_INCLUDE_DIRS)
+    find_package_handle_standard_args(BLASEXT DEFAULT_MSG
+      BLAS_PAR_LIBRARIES)
   endif()
 elseif(BLA_VENDOR MATCHES "ACML*")
   if(NOT BLASEXT_FIND_QUIETLY)
-    message(STATUS "BLAS found is ACML:"
-      "\n   we manage two lists of libs, one sequential and one parallel if found"
-      "\n   (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")
+    message(STATUS "BLAS found is ACML")
     message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
   endif()
-  find_package_handle_standard_args(BLAS DEFAULT_MSG
+  find_package_handle_standard_args(BLASEXT DEFAULT_MSG
     BLAS_SEQ_LIBRARIES
     BLAS_LIBRARY_DIRS)
   if(BLAS_PAR_LIBRARIES)
     if(NOT BLASEXT_FIND_QUIETLY)
       message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES")
     endif()
-    find_package_handle_standard_args(BLAS DEFAULT_MSG
+    find_package_handle_standard_args(BLASEXT DEFAULT_MSG
       BLAS_PAR_LIBRARIES)
   endif()
 elseif(BLA_VENDOR MATCHES "IBMESSL*")
   if(NOT BLASEXT_FIND_QUIETLY)
-    message(STATUS "BLAS found is ESSL:"
-      "\n   we manage two lists of libs, one sequential and one parallel if found"
-      "\n   (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")
+    message(STATUS "BLAS found is ESSL")
     message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
   endif()
-  find_package_handle_standard_args(BLAS DEFAULT_MSG
+  find_package_handle_standard_args(BLASEXT DEFAULT_MSG
     BLAS_SEQ_LIBRARIES
     BLAS_LIBRARY_DIRS)
   if(BLAS_PAR_LIBRARIES)
     if(NOT BLASEXT_FIND_QUIETLY)
       message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES")
     endif()
-    find_package_handle_standard_args(BLAS DEFAULT_MSG
+    find_package_handle_standard_args(BLASEXT DEFAULT_MSG
       BLAS_PAR_LIBRARIES)
   endif()
 else()
   if(NOT BLASEXT_FIND_QUIETLY)
     message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
   endif()
-  find_package_handle_standard_args(BLAS DEFAULT_MSG
+  find_package_handle_standard_args(BLASEXT DEFAULT_MSG
     BLAS_SEQ_LIBRARIES
     BLAS_LIBRARY_DIRS)
 endif()
+
+if (BLAS_LIBRARIES)
+  set(BLASEXT_LIBRARIES ${BLAS_LIBRARIES})
+endif()
+if (BLAS_INCLUDE_DIRS)
+  set(BLASEXT_INCLUDE_DIRS ${BLAS_INCLUDE_DIRS})
+endif()
+if (BLAS_LIBRARY_DIRS)
+  set(BLASEXT_LIBRARY_DIRS ${BLAS_LIBRARY_DIRS})
+endif()
diff --git a/modules/find/FindFFTW.cmake b/modules/find/FindFFTW.cmake
index 5b5b36e689a4ae900f802c97473b65e0fa7d6006..14fbb7d2b94c17ce06ae5747f11642730c6ffdde 100644
--- a/modules/find/FindFFTW.cmake
+++ b/modules/find/FindFFTW.cmake
@@ -767,8 +767,6 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
 	message(STATUS "CMAKE_REQUIRED_FLAGS: ${CMAKE_REQUIRED_FLAGS}")
 	message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
       endif()
-    else()
-      set(FFTW_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
     endif()
     set(CMAKE_REQUIRED_INCLUDES)
     set(CMAKE_REQUIRED_FLAGS)
diff --git a/modules/find/FindHQR.cmake b/modules/find/FindHQR.cmake
index 14863c2b8e5e6e31499cf968d3903598475a07bc..563518e7f8aa476eda0e5658d89c372729321086 100644
--- a/modules/find/FindHQR.cmake
+++ b/modules/find/FindHQR.cmake
@@ -77,8 +77,8 @@ if(PKG_CONFIG_EXECUTABLE AND NOT HQR_GIVEN_BY_USER)
       #endif()
     else()
       message(STATUS "${Magenta}Looking for HQR - not found using PkgConfig."
-	"\n   Perhaps you should add the directory containing hqr.pc to the"
-	"\n   PKG_CONFIG_PATH environment variable.${ColourReset}")
+        "\n   Perhaps you should add the directory containing hqr.pc to the"
+        "\n   PKG_CONFIG_PATH environment variable.${ColourReset}")
     endif()
   endif()
 
@@ -133,14 +133,14 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HQR_FOUND) OR
     if(HQR_DIR)
       set(HQR_libhqr.h_DIRS "HQR_libhqr.h_DIRS-NOTFOUND")
       find_path(HQR_libhqr.h_DIRS
-	NAMES libhqr.h
-	HINTS ${HQR_DIR}
+        NAMES libhqr.h
+        HINTS ${HQR_DIR})
     else()
       set(HQR_libhqr.h_DIRS "HQR_libhqr.h_DIRS-NOTFOUND")
       find_path(HQR_libhqr.h_DIRS
-	NAMES libhqr.h
-	HINTS ${_inc_env}
-	PATH_SUFFIXES "hqr")
+        NAMES libhqr.h
+        HINTS ${_inc_env}
+        PATH_SUFFIXES "hqr")
     endif()
   endif()
   mark_as_advanced(HQR_libhqr.h_DIRS)
@@ -177,9 +177,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HQR_FOUND) OR
       string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
     else()
       if(APPLE)
-	string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
+        string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
       else()
-	string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
+        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}")
@@ -200,14 +200,14 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HQR_FOUND) OR
     if(HQR_DIR)
       set(HQR_hqr_LIBRARY "HQR_hqr_LIBRARY-NOTFOUND")
       find_library(HQR_hqr_LIBRARY
-	NAMES hqr
-	HINTS ${HQR_DIR}
-	PATH_SUFFIXES lib lib32 lib64)
+        NAMES hqr
+        HINTS ${HQR_DIR}
+        PATH_SUFFIXES lib lib32 lib64)
     else()
       set(HQR_hqr_LIBRARY "HQR_hqr_LIBRARY-NOTFOUND")
       find_library(HQR_hqr_LIBRARY
-	NAMES hqr
-	HINTS ${_lib_env})
+        NAMES hqr
+        HINTS ${_lib_env})
     endif()
   endif()
   mark_as_advanced(HQR_hqr_LIBRARY)
@@ -259,15 +259,15 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HQR_FOUND) OR
     # test link
     unset(HQR_WORKS CACHE)
     include(CheckFunctionExists)
-    check_function_exists(libhqr_hqr_init HQR_WORKS)
+    check_function_exists(libhqr_init_hqr HQR_WORKS)
     mark_as_advanced(HQR_WORKS)
 
     if(NOT HQR_WORKS)
       if(NOT HQR_FIND_QUIETLY)
-	message(STATUS "Looking for hqr : test of libhqr_hqr_init with hqr 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")
+        message(STATUS "Looking for hqr : test of libhqr_hqr_init with hqr 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)
diff --git a/modules/find/FindHWLOC.cmake b/modules/find/FindHWLOC.cmake
index 8a0eb7d206ea8ae6cac65cda5820a884c70d8375..4d7c47f7ba6d4ff7507894c5c25c234a8ffbea95 100644
--- a/modules/find/FindHWLOC.cmake
+++ b/modules/find/FindHWLOC.cmake
@@ -321,6 +321,18 @@ endif()
 if (HWLOC_FOUND)
   set(HWLOC_SAVE_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
   list(APPEND CMAKE_REQUIRED_INCLUDES ${HWLOC_INCLUDE_DIRS})
+  set(CMAKE_REQUIRED_LIBRARIES)
+  if (HWLOC_LIBRARY_DIRS)
+    set (LIBDIR ${HWLOC_LIBRARY_DIRS})
+  elseif(HWLOC_LIBDIR)
+    set (LIBDIR ${HWLOC_LIBDIR})
+  endif()
+  if (LIBDIR)
+    foreach(lib_dir ${LIBDIR})
+      list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
+    endforeach()
+  endif()
+  string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
 
   # test headers to guess the version
   check_struct_has_member( "struct hwloc_obj" parent hwloc.h HAVE_HWLOC_PARENT_MEMBER )
diff --git a/modules/find/FindHYPRE.cmake b/modules/find/FindHYPRE.cmake
index 944b5ecbdb952d13a4b2e0bee15352cda500bc52..8823f6a1b6f993dc699f884885ec174083814bea 100644
--- a/modules/find/FindHYPRE.cmake
+++ b/modules/find/FindHYPRE.cmake
@@ -1,4 +1,7 @@
 ###
+# WARNING: only HYPRE lib is searched for now
+# it is surely too simple, must be completed
+###
 #
 # @copyright (c) 2009-2014 The University of Tennessee and The University
 #                          of Tennessee Research Foundation.
diff --git a/modules/find/FindLAPACK.cmake b/modules/find/FindLAPACK.cmake
index 0a517819e60c9d81e1147f9bcf8e2a1a327547b8..3fceeb7ccda19465f97de320eed1f809d5be27cb 100644
--- a/modules/find/FindLAPACK.cmake
+++ b/modules/find/FindLAPACK.cmake
@@ -244,7 +244,6 @@ macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads
       find_library(${_prefix}_${_library}_LIBRARY
         NAMES ${_library}
         HINTS ${_libdir}
-        NO_DEFAULT_PATH
         )
       mark_as_advanced(${_prefix}_${_library}_LIBRARY)
       # Print status if not found
diff --git a/modules/find/FindLAPACKE.cmake b/modules/find/FindLAPACKE.cmake
index 55fc87e6960acd11223a2ea65cea10f36ec1de94..860e50f3f2fe7d0eacaaf1f67120cf6ec0f278fb 100644
--- a/modules/find/FindLAPACKE.cmake
+++ b/modules/find/FindLAPACKE.cmake
@@ -3,7 +3,7 @@
 # @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-2017 Inria. All rights reserved.
 # @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
 #
 ###
@@ -18,6 +18,11 @@
 #  LAPACKE depends on the following libraries:
 #   - LAPACK
 #
+#  COMPONENTS are optional libraries CHAMELEON could be linked with,
+#  Use it to drive detection of a specific compilation chain
+#  COMPONENTS can be some of the following:
+#   - TMG: to check that LAPACKE provides the tmglib interface
+#
 # This module finds headers and lapacke library.
 # Results are reported in variables:
 #  LAPACKE_FOUND            - True if headers and requested libraries were found
@@ -49,7 +54,7 @@
 # Copyright 2012-2013 Emmanuel Agullo
 # Copyright 2012-2013 Mathieu Faverge
 # Copyright 2012      Cedric Castagnede
-# Copyright 2013-2016 Florent Pruvost
+# Copyright 2013-2017 Florent Pruvost
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file MORSE-Copyright.txt for details.
@@ -68,6 +73,16 @@ if (NOT LAPACKE_FOUND)
   endif()
 endif()
 
+# to check that LAPACKE provides the tmglib interface
+set(LAPACKE_WITH_TMG OFF)
+if( LAPACKE_FIND_COMPONENTS )
+  foreach( component ${LAPACKE_FIND_COMPONENTS} )
+    if (${component} STREQUAL "TMG")
+      set(LAPACKE_WITH_TMG ON)
+    endif()
+  endforeach()
+endif()
+
 # LAPACKE depends on LAPACK anyway, try to find it
 if (NOT LAPACK_FOUND)
   if(LAPACKE_FIND_REQUIRED)
@@ -324,6 +339,10 @@ if (LAPACK_FOUND)
       unset(LAPACKE_WORKS CACHE)
       include(CheckFunctionExists)
       check_function_exists(LAPACKE_dgeqrf LAPACKE_WORKS)
+      if (LAPACKE_WORKS AND LAPACKE_WITH_TMG)
+        unset(LAPACKE_WORKS CACHE)
+        check_function_exists(LAPACKE_dlatms_work LAPACKE_WORKS)
+      endif()
       mark_as_advanced(LAPACKE_WORKS)
 
       if(LAPACKE_WORKS)
diff --git a/modules/find/FindLAPACKEXT.cmake b/modules/find/FindLAPACKEXT.cmake
index bf62c3d7071cce623a64a78aa55c52935b0e5256..7cce67022fbeb3503ec6d67a0ee878a67bb226af 100644
--- a/modules/find/FindLAPACKEXT.cmake
+++ b/modules/find/FindLAPACKEXT.cmake
@@ -3,7 +3,7 @@
 # @copyright (c) 2009-2014 The University of Tennessee and The University
 #                          of Tennessee Research Foundation.
 #                          All rights reserved.
-# @copyright (c) 2012-2014 Inria. All rights reserved.
+# @copyright (c) 2012-2017 Inria. All rights reserved.
 # @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
 #
 ###
@@ -18,17 +18,21 @@
 #
 # The following variables have been added to manage links with sequential or multithreaded
 # versions:
-#  LAPACK_INCLUDE_DIRS  - LAPACK include directories
-#  LAPACK_LIBRARY_DIRS  - Link directories for LAPACK libraries
-#  LAPACK_SEQ_LIBRARIES - LAPACK component libraries to be linked (sequential)
-#  LAPACK_PAR_LIBRARIES - LAPACK component libraries to be linked (multithreaded)
+#  LAPACK_INCLUDE_DIRS    - LAPACK include directories
+#  LAPACK_LIBRARY_DIRS    - Link directories for LAPACK libraries
+#  LAPACK_SEQ_LIBRARIES   - LAPACK component libraries to be linked (sequential)
+#  LAPACK_PAR_LIBRARIES   - LAPACK component libraries to be linked (multithreaded)
+#  LAPACKEXT_FOUND        - if a LAPACK has been found
+#  LAPACKEXT_LIBRARIES    - Idem LAPACK_LIBRARIES
+#  LAPACKEXT_INCLUDE_DIRS - Idem LAPACK_INCLUDE_DIRS
+#  LAPACKEXT_LIBRARY_DIRS - Idem LAPACK_LIBRARY_DIRS
 
 #=============================================================================
 # Copyright 2012-2013 Inria
 # Copyright 2012-2013 Emmanuel Agullo
 # Copyright 2012-2013 Mathieu Faverge
 # Copyright 2012      Cedric Castagnede
-# Copyright 2013      Florent Pruvost
+# Copyright 2013-2017 Florent Pruvost
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file MORSE-Copyright.txt for details.
@@ -40,9 +44,10 @@
 # (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)
+# Macro to factorize this call. required arguments allows to decide if
+# the REQUIRED option must be given to find_package calls
+macro(find_package_lapack required)
+  if(LAPACKEXT_FIND_REQUIRED AND required)
     if(LAPACKEXT_FIND_QUIETLY)
       find_package(LAPACK REQUIRED QUIET)
     else()
@@ -57,22 +62,12 @@ macro(find_package_lapack)
   endif()
 endmacro()
 
-# LAPACKEXT depends on BLASEXT
-# call our extended module for BLAS
-#----------------------------------
+# LAPACKEXT depends on BLAS
 if (NOT BLAS_FOUND)
-  if(LAPACKEXT_FIND_REQUIRED)
-    if(LAPACKEXT_FIND_QUIETLY)
-      find_package(BLAS REQUIRED QUIET)
-    else()
-      find_package(BLAS REQUIRED)
-    endif()
+  if(LAPACKEXT_FIND_QUIETLY)
+    find_package(BLAS QUIET)
   else()
-    if(LAPACKEXT_FIND_QUIETLY)
-      find_package(BLAS QUIET)
-    else()
-      find_package(BLAS)
-    endif()
+    find_package(BLAS)
   endif()
 endif ()
 
@@ -123,13 +118,13 @@ if(BLA_VENDOR MATCHES "Intel*")
   else()
     if(LAPACK_DIR)
       find_path(LAPACK_mkl_lapack.h_INCLUDE_DIRS
-	NAMES mkl_lapack.h
-	HINTS ${LAPACK_DIR}
-	PATH_SUFFIXES include)
+        NAMES mkl_lapack.h
+        HINTS ${LAPACK_DIR}
+        PATH_SUFFIXES include)
     else()
       find_path(LAPACK_mkl_lapack.h_INCLUDE_DIRS
-	NAMES mkl_lapack.h
-	HINTS ${_inc_env})
+        NAMES mkl_lapack.h
+        HINTS ${_inc_env})
     endif()
   endif()
   mark_as_advanced(LAPACK_mkl_lapack.h_INCLUDE_DIRS)
@@ -151,7 +146,7 @@ if(BLA_VENDOR MATCHES "Intel*")
     ## look for the sequential version
     set(BLA_VENDOR "Intel10_64lp_seq")
   endif()
-  find_package_lapack()
+  find_package_lapack(0)
 
   if (LAPACK_FOUND)
     if(BLAS_SEQ_LIBRARIES)
@@ -162,9 +157,9 @@ if(BLA_VENDOR MATCHES "Intel*")
     # if BLAS Intel 10 64 bit -> save sequential and multithreaded versions
     if(BLA_VENDOR MATCHES "Intel10_64lp*")
       if(BLAS_PAR_LIBRARIES)
-	set(LAPACK_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES}")
+        set(LAPACK_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES}")
       else()
-	set(LAPACK_PAR_LIBRARIES "${LAPACK_PAR_LIBRARIES-NOTFOUND}")
+        set(LAPACK_PAR_LIBRARIES "${LAPACK_PAR_LIBRARIES-NOTFOUND}")
       endif()
     endif()
   endif()
@@ -173,7 +168,7 @@ elseif(BLA_VENDOR MATCHES "IBMESSL*")
 
   ## look for the sequential version
   set(BLA_VENDOR "IBMESSL")
-  find_package_lapack()
+  find_package_lapack(0)
 
   if (LAPACK_FOUND)
     if(LAPACK_LIBRARIES)
@@ -185,7 +180,7 @@ elseif(BLA_VENDOR MATCHES "IBMESSL*")
 
   ## look for the multithreaded version
   set(BLA_VENDOR "IBMESSLMT")
-  find_package_lapack()
+  find_package_lapack(0)
 
   if (LAPACK_FOUND)
     if(LAPACK_LIBRARIES)
@@ -200,7 +195,7 @@ elseif(BLA_VENDOR MATCHES "ACML*")
   ###
   # look for libs
   ###
-  find_package_lapack()
+  find_package_lapack(0)
 
   if (LAPACK_FOUND)
     if(BLAS_SEQ_LIBRARIES)
@@ -235,7 +230,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
-  find_package_lapack()
+  find_package_lapack(0)
 
   if(LAPACK_FOUND)
     set(LAPACK_SEQ_LIBRARIES "${LAPACK_LIBRARIES}")
@@ -265,7 +260,7 @@ foreach(lapack_lib ${LAPACK_LIBRARIES})
     else()
       get_filename_component(a_lapack_lib_dir "${lapack_lib}" PATH)
       if (EXISTS "${a_lapack_lib_dir}")
-	list(APPEND LAPACK_LIBRARY_DIRS "${a_lapack_lib_dir}" )
+        list(APPEND LAPACK_LIBRARY_DIRS "${a_lapack_lib_dir}" )
       endif()
     endif()
   endif()
@@ -274,77 +269,70 @@ if (LAPACK_LIBRARY_DIRS)
   list(REMOVE_DUPLICATES LAPACK_LIBRARY_DIRS)
 endif ()
 
-# check that LAPACK has been found
-# ---------------------------------
+# check that LAPACKEXT has been found
+# -----------------------------------
 include(FindPackageHandleStandardArgs)
 if(BLA_VENDOR MATCHES "Intel*")
-  if(BLA_VENDOR MATCHES "Intel10_64lp*")
     if(NOT LAPACKEXT_FIND_QUIETLY)
-      message(STATUS "LAPACK found is Intel MKL:"
-	"\n   we manage two lists of libs, one sequential and one parallel"
-	"\n   (see LAPACK_SEQ_LIBRARIES and LAPACK_PAR_LIBRARIES)")
+      message(STATUS "LAPACK found is Intel MKL")
       message(STATUS "LAPACK sequential libraries stored in LAPACK_SEQ_LIBRARIES")
     endif()
-    find_package_handle_standard_args(LAPACK DEFAULT_MSG
+    find_package_handle_standard_args(LAPACKEXT DEFAULT_MSG
       LAPACK_SEQ_LIBRARIES
       LAPACK_LIBRARY_DIRS
       LAPACK_INCLUDE_DIRS)
-    if(LAPACK_PAR_LIBRARIES)
+    if(BLA_VENDOR MATCHES "Intel10_64lp*" AND LAPACK_PAR_LIBRARIES)
       if(NOT LAPACKEXT_FIND_QUIETLY)
-	message(STATUS "LAPACK parallel libraries stored in LAPACK_PAR_LIBRARIES")
+        message(STATUS "LAPACK parallel libraries stored in LAPACK_PAR_LIBRARIES")
       endif()
-      find_package_handle_standard_args(LAPACK DEFAULT_MSG
-	LAPACK_PAR_LIBRARIES)
-    endif()
-
-  else()
-    if(NOT LAPACKEXT_FIND_QUIETLY)
-      message(STATUS "LAPACK sequential libraries stored in LAPACK_SEQ_LIBRARIES")
+      find_package_handle_standard_args(LAPACKEXT DEFAULT_MSG
+        LAPACK_PAR_LIBRARIES)
     endif()
-    find_package_handle_standard_args(LAPACK DEFAULT_MSG
-      LAPACK_SEQ_LIBRARIES
-      LAPACK_LIBRARY_DIRS
-      LAPACK_INCLUDE_DIRS)
-  endif()
 elseif(BLA_VENDOR MATCHES "ACML*")
   if(NOT LAPACKEXT_FIND_QUIETLY)
-    message(STATUS "LAPACK found is ACML:"
-      "\n   we manage two lists of libs, one sequential and one parallel"
-      "\n   (see LAPACK_SEQ_LIBRARIES and LAPACK_PAR_LIBRARIES)")
+    message(STATUS "LAPACK found is ACML")
     message(STATUS "LAPACK sequential libraries stored in LAPACK_SEQ_LIBRARIES")
   endif()
-  find_package_handle_standard_args(LAPACK DEFAULT_MSG
+  find_package_handle_standard_args(LAPACKEXT DEFAULT_MSG
     LAPACK_SEQ_LIBRARIES
     LAPACK_LIBRARY_DIRS)
   if(LAPACK_PAR_LIBRARIES)
     if(NOT LAPACKEXT_FIND_QUIETLY)
       message(STATUS "LAPACK parallel libraries stored in LAPACK_PAR_LIBRARIES")
     endif()
-    find_package_handle_standard_args(LAPACK DEFAULT_MSG
+    find_package_handle_standard_args(LAPACKEXT DEFAULT_MSG
       LAPACK_PAR_LIBRARIES)
   endif()
 elseif(BLA_VENDOR MATCHES "IBMESSL*")
   if(NOT LAPACKEXT_FIND_QUIETLY)
-    message(STATUS "LAPACK found is IBMESSL:"
-      "\n   we manage two lists of libs, one sequential and one parallel"
-      "\n   (see LAPACK_SEQ_LIBRARIES and LAPACK_PAR_LIBRARIES)")
+    message(STATUS "LAPACK found is IBMESSL")
     message(STATUS "LAPACK sequential libraries stored in LAPACK_SEQ_LIBRARIES")
   endif()
-  find_package_handle_standard_args(LAPACK DEFAULT_MSG
+  find_package_handle_standard_args(LAPACKEXT DEFAULT_MSG
     LAPACK_SEQ_LIBRARIES
     LAPACK_LIBRARY_DIRS)
   if(LAPACK_PAR_LIBRARIES)
     if(NOT LAPACKEXT_FIND_QUIETLY)
       message(STATUS "LAPACK parallel libraries stored in LAPACK_PAR_LIBRARIES")
     endif()
-    find_package_handle_standard_args(LAPACK DEFAULT_MSG
+    find_package_handle_standard_args(LAPACKEXT DEFAULT_MSG
       LAPACK_PAR_LIBRARIES)
   endif()
 else()
   if(NOT LAPACKEXT_FIND_QUIETLY)
     message(STATUS "LAPACK sequential libraries stored in LAPACK_SEQ_LIBRARIES")
   endif()
-  find_package_handle_standard_args(LAPACK DEFAULT_MSG
+  find_package_handle_standard_args(LAPACKEXT DEFAULT_MSG
     LAPACK_SEQ_LIBRARIES
     LAPACK_LIBRARY_DIRS)
 endif()
+
+if (LAPACK_LIBRARIES)
+  set(LAPACKEXT_LIBRARIES ${LAPACK_LIBRARIES})
+endif()
+if (LAPACK_INCLUDE_DIRS)
+  set(LAPACKEXT_INCLUDE_DIRS ${LAPACK_INCLUDE_DIRS})
+endif()
+if (LAPACK_LIBRARY_DIRS)
+  set(LAPACKEXT_LIBRARY_DIRS ${LAPACK_LIBRARY_DIRS})
+endif()
diff --git a/modules/find/FindMAGMA.cmake b/modules/find/FindMAGMA.cmake
index c4f740ae45770c404eba6d429ba79377266154a1..c3627af398c381dfbb6164fcc7231c7418b5fba8 100644
--- a/modules/find/FindMAGMA.cmake
+++ b/modules/find/FindMAGMA.cmake
@@ -1,4 +1,6 @@
 ###
+# WARNING: not maintained anymore
+###
 #
 # @copyright (c) 2009-2014 The University of Tennessee and The University
 #                          of Tennessee Research Foundation.
@@ -126,28 +128,28 @@ if(PKG_CONFIG_EXECUTABLE AND NOT MAGMA_GIVEN_BY_USER)
       #endif()
     else()
       message(STATUS "${Magenta}Looking for MAGMA - not found using PkgConfig. "
-	"\n   Perhaps you should add the directory containing magma.pc "
-	"\n   to the PKG_CONFIG_PATH environment variable.${ColourReset}")
+        "\n   Perhaps you should add the directory containing magma.pc "
+        "\n   to the PKG_CONFIG_PATH environment variable.${ColourReset}")
     endif()
   endif()
 
   if (MAGMA_FIND_VERSION_EXACT)
     if( NOT (MAGMA_FIND_VERSION_MAJOR STREQUAL MAGMA_VERSION_MAJOR) OR
-	NOT (MAGMA_FIND_VERSION_MINOR STREQUAL MAGMA_VERSION_MINOR) )
+        NOT (MAGMA_FIND_VERSION_MINOR STREQUAL MAGMA_VERSION_MINOR) )
       if(NOT MAGMA_FIND_QUIETLY)
-	message(FATAL_ERROR
-	  "MAGMA version found is ${MAGMA_VERSION_STRING} "
-	  "when required is ${MAGMA_FIND_VERSION}")
+        message(FATAL_ERROR
+          "MAGMA version found is ${MAGMA_VERSION_STRING} "
+          "when required is ${MAGMA_FIND_VERSION}")
       endif()
     endif()
   else()
     # if the version found is older than the required then error
     if( (MAGMA_FIND_VERSION_MAJOR STRGREATER MAGMA_VERSION_MAJOR) OR
-	(MAGMA_FIND_VERSION_MINOR STRGREATER MAGMA_VERSION_MINOR) )
+        (MAGMA_FIND_VERSION_MINOR STRGREATER MAGMA_VERSION_MINOR) )
       if(NOT MAGMA_FIND_QUIETLY)
-	message(FATAL_ERROR
-	  "MAGMA version found is ${MAGMA_VERSION_STRING} "
-	  "when required is ${MAGMA_FIND_VERSION} or newer")
+        message(FATAL_ERROR
+          "MAGMA version found is ${MAGMA_VERSION_STRING} "
+          "when required is ${MAGMA_FIND_VERSION} or newer")
       endif()
     endif()
   endif()
@@ -219,14 +221,14 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) O
     if(MAGMA_DIR)
       set(MAGMA_magma.h_DIRS "MAGMA_magma.h_DIRS-NOTFOUND")
       find_path(MAGMA_magma.h_DIRS
-	NAMES magma.h
-	HINTS ${MAGMA_DIR}
-	PATH_SUFFIXES "include" "include/magma")
+        NAMES magma.h
+        HINTS ${MAGMA_DIR}
+        PATH_SUFFIXES "include" "include/magma")
     else()
       set(MAGMA_magma.h_DIRS "MAGMA_magma.h_DIRS-NOTFOUND")
       find_path(MAGMA_magma.h_DIRS
-	NAMES magma.h
-	HINTS ${_inc_env})
+        NAMES magma.h
+        HINTS ${_inc_env})
     endif()
   endif()
   mark_as_advanced(MAGMA_magma.h_DIRS)
@@ -260,9 +262,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) O
       string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
     else()
       if(APPLE)
-	string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
+        string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
       else()
-	string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
+        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}")
@@ -283,14 +285,14 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) O
     if(MAGMA_DIR)
       set(MAGMA_magma_LIBRARY "MAGMA_magma_LIBRARY-NOTFOUND")
       find_library(MAGMA_magma_LIBRARY
-	NAMES magma
-	HINTS ${MAGMA_DIR}
-	PATH_SUFFIXES lib lib32 lib64)
+        NAMES magma
+        HINTS ${MAGMA_DIR}
+        PATH_SUFFIXES lib lib32 lib64)
     else()
       set(MAGMA_magma_LIBRARY "MAGMA_magma_LIBRARY-NOTFOUND")
       find_library(MAGMA_magma_LIBRARY
-	NAMES magma
-	HINTS ${_lib_env})
+        NAMES magma
+        HINTS ${_lib_env})
     endif()
   endif()
   mark_as_advanced(MAGMA_magma_LIBRARY)
@@ -392,11 +394,11 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) O
       list(REMOVE_DUPLICATES MAGMA_LINKER_FLAGS)
     else()
       if(NOT MAGMA_FIND_QUIETLY)
-	message(STATUS "Looking for magma : test of magma_dgetrf with
-		magma, cblas, cuda and lapack libraries 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")
+        message(STATUS "Looking for magma : test of magma_dgetrf with
+                magma, cblas, cuda and lapack libraries 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)
@@ -410,7 +412,7 @@ if (MAGMA_LIBRARIES)
   if (MAGMA_LIBRARY_DIRS)
     foreach(dir ${MAGMA_LIBRARY_DIRS})
       if ("${dir}" MATCHES "magma")
-	set(first_lib_path "${dir}")
+        set(first_lib_path "${dir}")
       endif()
     endforeach()
   else()
diff --git a/modules/find/FindMPIEXT.cmake b/modules/find/FindMPIEXT.cmake
index 1409989751594a714a0d4d17a23adb194aff356e..417eccb6c1ba152b941701c6cef2afcec3287629 100644
--- a/modules/find/FindMPIEXT.cmake
+++ b/modules/find/FindMPIEXT.cmake
@@ -3,6 +3,7 @@
 # This module allows to find MPI libraries by calling the official FindMPI module
 # and adds an additional variable indicating the level of thread supported:
 #  MPI_THREAD_SUPPORTED_LEVEL - MPI_THREAD_MULTIPLE, MPI_THREAD_SERIALIZED, MPI_THREAD_FUNNELED, or MPI_THREAD_SINGLE
+#  MPIEXT_FOUND        - if a MPI has been found
 
 #=============================================================================
 # Copyright 2012-2013 Inria
@@ -29,8 +30,10 @@ if (NOT MPI_FOUND)
     find_package(MPI)
   endif()
 endif ()
+set(MPIEXT_FOUND ${MPI_FOUND})
 
 if (MPI_FOUND)
+
   set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
   set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES})
   set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
@@ -103,9 +106,9 @@ int main(int argc, char **argv) {
     if(NOT SERIALIZED_TEST_RUNS)
       check_c_source_runs("${MPI_C_TEST_FUNNELED_SOURCE}" FUNNELED_TEST_RUNS)
       if(NOT FUNNELED_TEST_RUNS)
-	set(MPI_THREAD_SUPPORTED_LEVEL "MPI_THREAD_SINGLE")
+        set(MPI_THREAD_SUPPORTED_LEVEL "MPI_THREAD_SINGLE")
       else(NOT FUNNELED_TEST_RUNS)
-	set(MPI_THREAD_SUPPORTED_LEVEL "MPI_THREAD_FUNNELED")
+        set(MPI_THREAD_SUPPORTED_LEVEL "MPI_THREAD_FUNNELED")
       endif(NOT FUNNELED_TEST_RUNS)
     else(NOT SERIALIZED_TEST_RUNS)
       set(MPI_THREAD_SUPPORTED_LEVEL "MPI_THREAD_SERIALIZED")
@@ -117,4 +120,5 @@ int main(int argc, char **argv) {
   set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
   set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE})
   set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
+
 endif(MPI_FOUND)
diff --git a/modules/find/FindPARMETIS.cmake b/modules/find/FindPARMETIS.cmake
index fd2bd3f49c8b3d230868f0b228ca7b363c735872..ad7953a2fe0acaa3fdc206676feed00ae57c47de 100644
--- a/modules/find/FindPARMETIS.cmake
+++ b/modules/find/FindPARMETIS.cmake
@@ -3,7 +3,7 @@
 # @copyright (c) 2009-2014 The University of Tennessee and The University
 #                          of Tennessee Research Foundation.
 #                          All rights reserved.
-# @copyright (c) 2012-2014 Inria. All rights reserved.
+# @copyright (c) 2012-2017 Inria. All rights reserved.
 # @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
 #
 ###
@@ -14,6 +14,10 @@
 #               [REQUIRED]             # Fail with error if parmetis is not found
 #              )
 #
+#  PARMETIS depends on the following libraries:
+#   - METIS
+#   - MPI
+#
 # This module finds headers and parmetis library.
 # Results are reported in variables:
 #  PARMETIS_FOUND           - True if headers and requested libraries were found
@@ -23,9 +27,12 @@
 #
 # The user can give specific paths where to find the libraries adding cmake
 # options at configure (ex: cmake path/to/project -DPARMETIS_DIR=path/to/parmetis):
-#  PARMETIS_DIR             - Where to find the base directory of parmetis
-#  PARMETIS_INCDIR          - Where to find the header files
-#  PARMETIS_LIBDIR          - Where to find the library files
+#  PARMETIS_DIR              - Where to find the base directory of parmetis
+#  PARMETIS_INCDIR           - Where to find the header files
+#  PARMETIS_LIBDIR           - Where to find the library files
+#  PARMETIS_INCLUDE_DIRS_DEP - parmetis + dependencies include directories
+#  PARMETIS_LIBRARY_DIRS_DEP - parmetis + dependencies link directories
+#  PARMETIS_LIBRARIES_DEP    - parmetis libraries + dependencies
 # The module can also look for the following environment variables if paths
 # are not given as cmake variable: PARMETIS_DIR, PARMETIS_INCDIR, PARMETIS_LIBDIR
 
@@ -34,7 +41,7 @@
 # Copyright 2012-2013 Emmanuel Agullo
 # Copyright 2012-2013 Mathieu Faverge
 # Copyright 2012      Cedric Castagnede
-# Copyright 2013      Florent Pruvost
+# Copyright 2017      Florent Pruvost
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file MORSE-Copyright.txt for details.
@@ -53,6 +60,23 @@ if (NOT PARMETIS_FOUND)
   endif()
 endif()
 
+# PARMETIS depends on METIS, try to find it
+if (NOT METIS_FOUND)
+  if(PARMETIS_FIND_REQUIRED)
+    find_package(METIS REQUIRED)
+  else()
+    find_package(METIS)
+  endif()
+endif()
+
+# PARMETIS depends on MPI, try to find it
+if (NOT MPI_FOUND)
+  if(PARMETIS_FIND_REQUIRED)
+    find_package(MPI REQUIRED)
+  else()
+    find_package(MPI)
+  endif()
+endif()
 
 # Looking for include
 # -------------------
@@ -205,6 +229,31 @@ if(PARMETIS_LIBRARIES)
     set(REQUIRED_LIBDIRS "${PARMETIS_LIBRARY_DIRS}")
   endif()
   set(REQUIRED_LIBS "${PARMETIS_LIBRARIES}")
+  # METIS
+  if (METIS_FOUND)
+    if (METIS_INCLUDE_DIRS)
+      list(APPEND REQUIRED_INCDIRS "${METIS_INCLUDE_DIRS}")
+    endif()
+    foreach(libdir ${METIS_LIBRARY_DIRS})
+      if (libdir)
+        list(APPEND REQUIRED_LIBDIRS "${libdir}")
+      endif()
+    endforeach()
+    list(APPEND REQUIRED_LIBS "${METIS_LIBRARIES}")
+  endif()
+  # MPI
+  if (MPI_FOUND)
+    if (MPI_C_INCLUDE_PATH)
+      list(APPEND REQUIRED_INCDIRS "${MPI_C_INCLUDE_PATH}")
+    endif()
+    if (MPI_C_LINK_FLAGS)
+      if (${MPI_C_LINK_FLAGS} MATCHES "  -")
+        string(REGEX REPLACE " -" "-" MPI_C_LINK_FLAGS ${MPI_C_LINK_FLAGS})
+      endif()
+      list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}")
+    endif()
+    list(APPEND REQUIRED_LIBS "${MPI_C_LIBRARIES}")
+  endif()
   # m
   find_library(M_LIBRARY NAMES m)
   mark_as_advanced(M_LIBRARY)
@@ -227,7 +276,16 @@ if(PARMETIS_LIBRARIES)
   check_function_exists(ParMETIS_V3_NodeND PARMETIS_WORKS)
   mark_as_advanced(PARMETIS_WORKS)
 
-  if(NOT PARMETIS_WORKS)
+  if(PARMETIS_WORKS)
+    # save link with dependencies
+    set(PARMETIS_LIBRARIES_DEP "${REQUIRED_LIBS}")
+    set(PARMETIS_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
+    set(PARMETIS_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
+    set(PARMETIS_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
+    list(REMOVE_DUPLICATES PARMETIS_LIBRARY_DIRS_DEP)
+    list(REMOVE_DUPLICATES PARMETIS_INCLUDE_DIRS_DEP)
+    list(REMOVE_DUPLICATES PARMETIS_LINKER_FLAGS)
+  else()
     if(NOT PARMETIS_FIND_QUIETLY)
       message(STATUS "Looking for PARMETIS : test of ParMETIS_V3_NodeND with PARMETIS library fails")
       message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
diff --git a/modules/find/FindPASTIX.cmake b/modules/find/FindPASTIX.cmake
index 7458ef1e22412de32de491ccccd068b590200a0a..40dfc63feae6d0258894f5b1afd6e16b3ae98222 100644
--- a/modules/find/FindPASTIX.cmake
+++ b/modules/find/FindPASTIX.cmake
@@ -27,6 +27,7 @@
 #   - MPI: to activate detection of the parallel MPI version (default)
 #        it looks for Threads, HWLOC, BLAS, MPI and ScaLAPACK libraries
 #   - SEQ: to activate detection of the sequential version (exclude MPI version)
+#   - PARSEC: to activate detection of PASTIX with PARSEC
 #   - STARPU: to activate detection of StarPU version
 #   it looks for MPI version of StarPU (default behaviour)
 #   if SEQ and STARPU are given, it looks for a StarPU without MPI
@@ -35,7 +36,6 @@
 #   - SCOTCH: to activate detection of PASTIX linked with SCOTCH
 #   - PTSCOTCH: to activate detection of PASTIX linked with SCOTCH
 #   - METIS: to activate detection of PASTIX linked with SCOTCH
-#   - BLASMT: to use multithreaded BLAS only
 #
 # This module finds headers and pastix library.
 # Results are reported in variables:
@@ -85,12 +85,12 @@ endif()
 set(PASTIX_LOOK_FOR_MPI ON)
 set(PASTIX_LOOK_FOR_SEQ OFF)
 set(PASTIX_LOOK_FOR_STARPU OFF)
+set(PASTIX_LOOK_FOR_PARSEC OFF)
 set(PASTIX_LOOK_FOR_STARPU_CUDA OFF)
 set(PASTIX_LOOK_FOR_STARPU_FXT OFF)
 set(PASTIX_LOOK_FOR_SCOTCH ON)
 set(PASTIX_LOOK_FOR_PTSCOTCH OFF)
 set(PASTIX_LOOK_FOR_METIS OFF)
-set(PASTIX_LOOK_FOR_BLASMT OFF)
 
 if( PASTIX_FIND_COMPONENTS )
   foreach( component ${PASTIX_FIND_COMPONENTS} )
@@ -104,6 +104,9 @@ if( PASTIX_FIND_COMPONENTS )
       set(PASTIX_LOOK_FOR_SEQ OFF)
       set(PASTIX_LOOK_FOR_MPI ON)
     endif()
+    if (${component} STREQUAL "PARSEC")
+      set(PASTIX_LOOK_FOR_PARSEC ON)
+    endif()
     if (${component} STREQUAL "STARPU")
       # means we look for PaStiX with StarPU
       set(PASTIX_LOOK_FOR_STARPU ON)
@@ -126,9 +129,6 @@ if( PASTIX_FIND_COMPONENTS )
     if (${component} STREQUAL "METIS")
       set(PASTIX_LOOK_FOR_METIS ON)
     endif()
-    if (${component} STREQUAL "BLASMT")
-      set(PASTIX_LOOK_FOR_BLASMT ON)
-    endif()
   endforeach()
 endif()
 
@@ -213,12 +213,10 @@ endif()
 if (NOT PASTIX_FIND_QUIETLY)
   message(STATUS "Looking for PASTIX - Try to detect BLAS")
 endif()
-if (NOT BLAS_FOUND)
-  if (PASTIX_FIND_REQUIRED)
-    find_package(BLASEXT REQUIRED)
-  else()
-    find_package(BLASEXT)
-  endif()
+if (PASTIX_FIND_REQUIRED)
+  find_package(BLASEXT REQUIRED)
+else()
+  find_package(BLASEXT)
 endif()
 
 # Optional dependencies
@@ -247,6 +245,19 @@ if (NOT MPI_FOUND AND PASTIX_LOOK_FOR_MPI)
   endif()
 endif (NOT MPI_FOUND AND PASTIX_LOOK_FOR_MPI)
 
+# PASTIX may depends on SCOTCH
+#-----------------------------
+if (NOT PARSEC_FOUND AND PASTIX_LOOK_FOR_PARSEC)
+  if (NOT PASTIX_FIND_QUIETLY)
+    message(STATUS "Looking for PASTIX - Try to detect PARSEC")
+  endif()
+  if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_PARSEC)
+    find_package(PARSEC REQUIRED)
+  else()
+    find_package(PARSEC)
+  endif()
+endif()
+
 # PASTIX may depend on STARPU
 #----------------------------
 if( NOT STARPU_FOUND AND PASTIX_LOOK_FOR_STARPU)
@@ -505,6 +516,30 @@ if(PASTIX_LIBRARIES)
     endif()
   endforeach()
   set(REQUIRED_LIBS "${PASTIX_LIBRARIES}")
+  # PARSEC
+  if (PASTIX_LOOK_FOR_PARSEC AND PARSEC_FOUND)
+    if (PARSEC_INCLUDE_DIRS_DEP)
+      list(APPEND REQUIRED_INCDIRS "${PARSEC_INCLUDE_DIRS_DEP}")
+    elseif (PARSEC_INCLUDE_DIRS)
+      list(APPEND REQUIRED_INCDIRS "${PARSEC_INCLUDE_DIRS}")
+    endif()
+    if(PARSEC_LIBRARY_DIRS_DEP)
+      list(APPEND REQUIRED_LIBDIRS "${PARSEC_LIBRARY_DIRS_DEP}")
+    elseif(PARSEC_LIBRARY_DIRS)
+      list(APPEND REQUIRED_LIBDIRS "${PARSEC_LIBRARY_DIRS}")
+    endif()
+    if (PARSEC_LIBRARIES_DEP)
+      list(APPEND REQUIRED_LIBS "${PARSEC_LIBRARIES_DEP}")
+    elseif (PARSEC_LIBRARIES)
+      foreach(lib ${PARSEC_LIBRARIES})
+        if (EXISTS ${lib} OR ${lib} MATCHES "^-")
+          list(APPEND REQUIRED_LIBS "${lib}")
+        else()
+          list(APPEND REQUIRED_LIBS "-l${lib}")
+        endif()
+      endforeach()
+    endif()
+  endif()
   # STARPU
   if (PASTIX_LOOK_FOR_STARPU AND STARPU_FOUND)
     if (STARPU_INCLUDE_DIRS_DEP)
@@ -577,20 +612,12 @@ if(PASTIX_LIBRARIES)
     if (BLAS_INCLUDE_DIRS)
       list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}")
     endif()
-    if(PASTIX_LOOK_FOR_BLASMT)
-      set(_pastix_blas_lib ${BLAS_PAR_LIBRARIES})
-    else()
-      set(_pastix_blas_lib ${BLAS_SEQ_LIBRARIES})
-    endif()
-    if(NOT _pastix_blas_lib)
-      set(_pastix_blas_lib ${BLAS_LIBRARIES})
-    endif()
-    foreach(libdir ${_pastix_blas_lib})
+    foreach(libdir ${BLAS_LIBRARY_DIRS})
       if (libdir)
         list(APPEND REQUIRED_LIBDIRS "${libdir}")
       endif()
     endforeach()
-    list(APPEND REQUIRED_LIBS "${_pastix_blas_lib}")
+    list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}")
     if (BLAS_LINKER_FLAGS)
       list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")
     endif()
@@ -689,7 +716,7 @@ if(PASTIX_LIBRARIES)
       message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
       message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
       message(STATUS "Maybe PASTIX is linked with specific libraries. "
-        "Have you tried with COMPONENTS (MPI/SEQ, STARPU, STARPU_CUDA, SCOTCH, PTSCOTCH, METIS)? "
+        "Have you tried with COMPONENTS (MPI/SEQ, PARSEC, STARPU, STARPU_CUDA, SCOTCH, PTSCOTCH, METIS)? "
         "See the explanation in FindPASTIX.cmake.")
     endif()
   endif()
diff --git a/modules/find/FindPETSC.cmake b/modules/find/FindPETSC.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..cd1e3b93f8900588e3175485a15416ee91f29b67
--- /dev/null
+++ b/modules/find/FindPETSC.cmake
@@ -0,0 +1,210 @@
+# - Try to find PETSc
+# Once done this will define
+#
+#  PETSC_FOUND             - system has PETSc
+#  PETSC_INCLUDE_DIRS      - include directories for PETSc
+#  PETSC_LIBRARY_DIRS      - library directories for PETSc
+#  PETSC_LIBRARIES         - libraries for PETSc
+#  PETSC_STATIC_LIBRARIES  - libraries for PETSc (static linking, undefined if not required)
+#  PETSC_VERSION           - version for PETSc
+#  PETSC_VERSION_MAJOR     - First number in PETSC_VERSION
+#  PETSC_VERSION_MINOR     - Second number in PETSC_VERSION
+#  PETSC_VERSION_SUBMINOR  - Third number in PETSC_VERSION
+#  PETSC_INT_SIZE          - sizeof(PetscInt)
+#
+#=============================================================================
+# Copyright (C) 2010-2016 Garth N. Wells, Anders Logg and Johannes Ring
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+
+# Outline:
+# 1. Get flags from PETSc-generated pkg-config file
+# 2. Test compile and run program using shared library linking
+# 3. If shared library linking fails, test with static library linking
+
+# Load pkg-config module (provided by CMake)
+find_package(PkgConfig REQUIRED)
+
+# Find PETSc pkg-config file. Note: craypetsc_real is on Cray systems
+set(ENV{PKG_CONFIG_PATH} "$ENV{CRAY_PETSC_PREFIX_DIR}/lib/pkgconfig:$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
+pkg_search_module(PETSC craypetsc_real PETSc)
+
+# Extract major, minor, etc from version string
+if (PETSC_VERSION)
+  string(REPLACE "." ";" VERSION_LIST ${PETSC_VERSION})
+  list(GET VERSION_LIST 0 PETSC_VERSION_MAJOR)
+  list(GET VERSION_LIST 1 PETSC_VERSION_MINOR)
+  list(GET VERSION_LIST 2 PETSC_VERSION_SUBMINOR)
+endif()
+
+# Configure PETSc IMPORT (this involves creating an 'imported' target
+# and attaching 'properties')
+if (PETSC_FOUND AND NOT TARGET PETSC::petsc)
+  add_library(PETSC::petsc INTERFACE IMPORTED)
+
+  # Add include paths
+  set_property(TARGET PETSC::petsc PROPERTY
+    INTERFACE_INCLUDE_DIRECTORIES ${PETSC_INCLUDE_DIRS})
+
+  # Add libraries
+  unset(_libs)
+  foreach (lib ${PETSC_LIBRARIES})
+    find_library(LIB_${lib} NAMES ${lib} PATHS ${PETSC_LIBRARY_DIRS} NO_DEFAULT_PATH)
+    list(APPEND _libs ${LIB_${lib}})
+  endforeach()
+  set_property(TARGET PETSC::petsc PROPERTY INTERFACE_LINK_LIBRARIES "${_libs}")
+endif()
+
+# Configure PETSc 'static' IMPORT (this involves creating an
+# 'imported' target and attaching 'properties')
+if (PETSC_FOUND AND NOT TARGET PETSC::petsc_static)
+  add_library(PETSC::petsc_static INTERFACE IMPORTED)
+
+  # Add libraries (static)
+  unset(_libs)
+  foreach (lib ${PETSC_STATIC_LIBRARIES})
+    find_library(LIB_${lib} ${lib} HINTS ${PETSC_STATIC_LIBRARY_DIRS})
+    list(APPEND _libs ${LIB_${lib}})
+  endforeach()
+  set_property(TARGET PETSC::petsc_static PROPERTY INTERFACE_LINK_LIBRARIES "${_libs}")
+endif()
+
+# Attempt to build and run PETSc test program
+if (DOLFIN_SKIP_BUILD_TESTS)
+
+  # Assume PETSc works
+  set(PETSC_TEST_RUNS TRUE)
+
+elseif (PETSC_FOUND)
+
+  # Create PETSc test program
+  set(PETSC_TEST_LIB_CPP
+    "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/petsc_test_lib.cpp")
+  file(WRITE ${PETSC_TEST_LIB_CPP} "
+#include \"petscts.h\"
+#include \"petsc.h\"
+int main()
+{
+  PetscErrorCode ierr;
+  TS ts;
+  int argc = 0;
+  char** argv = NULL;
+  ierr = PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);CHKERRQ(ierr);
+  ierr = TSCreate(PETSC_COMM_WORLD,&ts);CHKERRQ(ierr);
+  ierr = TSSetFromOptions(ts);CHKERRQ(ierr);
+  ierr = TSDestroy(&ts);CHKERRQ(ierr);
+  ierr = PetscFinalize();CHKERRQ(ierr);
+  return 0;
+}
+")
+
+  # Add MPI variables if MPI has been found
+  if (MPI_C_FOUND)
+    set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${MPI_C_INCLUDE_PATH})
+    set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${MPI_C_LIBRARIES})
+    set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${MPI_C_COMPILE_FLAGS}")
+  endif()
+
+  # Try to run test program (shared linking)
+  try_run(
+    PETSC_TEST_LIB_EXITCODE
+    PETSC_TEST_LIB_COMPILED
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${PETSC_TEST_LIB_CPP}
+    CMAKE_FLAGS
+    "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
+    "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}"
+    LINK_LIBRARIES PETSC::petsc
+    COMPILE_OUTPUT_VARIABLE PETSC_TEST_LIB_COMPILE_OUTPUT
+    RUN_OUTPUT_VARIABLE PETSC_TEST_LIB_OUTPUT)
+
+  # Check program output
+  if (PETSC_TEST_LIB_COMPILED AND PETSC_TEST_LIB_EXITCODE EQUAL 0)
+
+    message(STATUS "Test PETSC_TEST_RUNS with shared library linking - Success")
+    set(PETSC_TEST_RUNS TRUE)
+
+    # Static libraries not required, so unset
+    set_property(TARGET PETSC::petsc_static PROPERTY INTERFACE_LINK_LIBRARIES)
+
+  else()
+
+    message(STATUS "Test PETSC_TEST_RUNS with shared library linking - Failed")
+
+    # Add MPI variables if MPI has been found
+    if (MPI_C_FOUND)
+      set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${MPI_C_INCLUDE_PATH})
+      set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${MPI_C_LIBRARIES})
+      set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${MPI_C_COMPILE_FLAGS}")
+    endif()
+
+    # Try to run test program (static linking)
+    try_run(
+      PETSC_TEST_LIB_EXITCODE
+      PETSC_TEST_LIB_COMPILED
+      ${CMAKE_CURRENT_BINARY_DIR}
+      ${PETSC_TEST_LIB_CPP}
+      CMAKE_FLAGS
+      "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
+      "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}"
+      LINK_LIBRARIES PETSC::petsc PETSC::petsc_static
+      COMPILE_OUTPUT_VARIABLE PETSC_TEST_LIB_COMPILE_OUTPUT
+      RUN_OUTPUT_VARIABLE PETSC_TEST_LIB_OUTPUT)
+
+    if (PETSC_TEST_LIB_COMPILED AND PETSC_TEST_LIB_EXITCODE EQUAL 0)
+      message(STATUS "Test PETSC_TEST_RUNS static linking - Success")
+      set(PETSC_TEST_RUNS TRUE)
+    else()
+      message(STATUS "Test PETSC_TEST_RUNS static linking - Failed")
+      set(PETSC_TEST_RUNS FALSE)
+    endif()
+
+  endif()
+endif()
+
+# Check sizeof(PetscInt)
+if (PETSC_INCLUDE_DIRS)
+  include(CheckTypeSize)
+  set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${PETSC_INCLUDE_DIRS})
+  set(CMAKE_EXTRA_INCLUDE_FILES petscsys.h)
+  check_type_size("PetscInt" PETSC_INT_SIZE)
+
+  unset(CMAKE_EXTRA_INCLUDE_FILES)
+  unset(CMAKE_REQUIRED_INCLUDES)
+endif()
+
+# Standard package handling
+include(FindPackageHandleStandardArgs)
+if (PETSC_FOUND)
+  find_package_handle_standard_args(PETSc
+    REQUIRED_VARS PETSC_FOUND PETSC_TEST_RUNS VERSION_VAR PETSC_VERSION
+    FAIL_MESSAGE "PETSc could not be configured.")
+else()
+  find_package_handle_standard_args(PETSc
+    REQUIRED_VARS PETSC_FOUND
+    FAIL_MESSAGE "PETSc could not be found. Be sure to set PETSC_DIR.")
+endif()
diff --git a/modules/find/FindPETSc.cmake b/modules/find/FindPETSc.cmake
deleted file mode 100644
index 1d7fb85953fbc681b3d0896d5602e9d2744610a7..0000000000000000000000000000000000000000
--- a/modules/find/FindPETSc.cmake
+++ /dev/null
@@ -1,318 +0,0 @@
-# - Try to find PETSc
-# Once done this will define
-#
-# PETSC_FOUND - system has PETSc
-# PETSC_INCLUDES - the PETSc include directories
-# PETSC_LIBRARIES - Link these to use PETSc
-# PETSC_COMPILER - Compiler used by PETSc, helpful to find a compatible MPI
-# PETSC_DEFINITIONS - Compiler switches for using PETSc
-# PETSC_MPIEXEC - Executable for running MPI programs
-# PETSC_VERSION - Version string (MAJOR.MINOR.SUBMINOR)
-#
-# Usage:
-# find_package(PETSc COMPONENTS CXX) - required if build --with-clanguage=C++ --with-c-support=0
-# find_package(PETSc COMPONENTS C) - standard behavior of checking build using a C compiler
-# find_package(PETSc) - same as above
-#
-# Setting these changes the behavior of the search
-# PETSC_DIR - directory in which PETSc resides
-# PETSC_ARCH - build architecture
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-#
-
-function (petsc_get_version)
-  if (EXISTS "${PETSC_DIR}/include/petscversion.h")
-    file (STRINGS "${PETSC_DIR}/include/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ")
-    foreach (line ${vstrings})
-      string (REGEX REPLACE " +" ";" fields ${line}) # break line into three fields (the first is always "#define")
-      list (GET fields 1 var)
-      list (GET fields 2 val)
-      set (${var} ${val} PARENT_SCOPE)
-      set (${var} ${val}) # Also in local scope so we have access below
-    endforeach ()
-    if (PETSC_VERSION_RELEASE)
-      set (PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}p${PETSC_VERSION_PATCH}" PARENT_SCOPE)
-    else ()
-      # make dev version compare higher than any patch level of a released version
-      set (PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}.99" PARENT_SCOPE)
-    endif ()
-  else ()
-    message (SEND_ERROR "PETSC_DIR can not be used, ${PETSC_DIR}/include/petscversion.h does not exist")
-  endif ()
-endfunction ()
-
-find_path (PETSC_DIR include/petsc.h
-  HINTS ENV PETSC_DIR
-  PATHS
-  ${AEROSOL_TOP_DIR}/../../petsc-3.3-p4 ${AEROSOL_TOP_DIR}/../../petsc-3.2-p7 ${AEROSOL_TOP_DIR}/../../petsc-3.2-p6 ${AEROSOL_TOP_DIR}/../../petsc-3.2-p5
-  ${AEROSOL_TOP_DIR}/../../petsc
-  /usr/lib/petscdir/3.1 /usr/lib/petscdir/3.0.0 /usr/lib/petscdir/2.3.3 /usr/lib/petscdir/2.3.2 # Debian
-  $ENV{HOME}/petsc
-  DOC "PETSc Directory")
-
-
-find_program (MAKE_EXECUTABLE NAMES make gmake)
-
-if (PETSC_DIR AND NOT PETSC_ARCH)
-  set (_petsc_arches
-    $ENV{PETSC_ARCH} # If set, use environment variable first
-    arch-linux2-cxx-opt arch-linux2-c-opt
-    arch-linux2-cxx-debug arch-linux2-c-debug
-    linux-x86_64-python
-    linux-gnu-c-debug linux-gnu-c-opt # Debian defaults
-    x86_64-unknown-linux-gnu i386-unknown-linux-gnu)
-  set (petscconf "NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
-  foreach (arch ${_petsc_arches})
-    if (NOT PETSC_ARCH)
-      find_path (petscconf petscconf.h
-	HINTS ${PETSC_DIR}
-	PATH_SUFFIXES ${arch}/include bmake/${arch}
-	NO_DEFAULT_PATH)
-      if (petscconf)
-	set (PETSC_ARCH "${arch}" CACHE STRING "PETSc build architecture")
-      endif (petscconf)
-    endif (NOT PETSC_ARCH)
-  endforeach (arch)
-  set (petscconf "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE)
-endif (PETSC_DIR AND NOT PETSC_ARCH)
-
-set(PETSC_VALID_COMPONENTS
-  C
-  CXX)
-
-if(NOT PETSc_FIND_COMPONENTS)
-  #on cherche si on a compile PETSc avec l'option --with-clanguage=cxx
-  #on regarde dans PETSC_ARCH si on trouve cxx
-  #on pourrait aussi chercher --with-clanguage=cxx dans configure.log
-  if (PETSC_ARCH)
-    string(REGEX MATCH "-cxx-" PETSc_FIND_COMPONENTS ${PETSC_ARCH})
-    if(PETSc_FIND_COMPONENTS)
-      set(PETSC_LANGUAGE_BINDINGS "CXX")
-    else(PETSc_FIND_COMPONENTS)
-      set(PETSC_LANGUAGE_BINDINGS "C")
-    endif(PETSc_FIND_COMPONENTS)
-  endif(PETSC_ARCH)
-else()
-  # Right now, this is designed for compatability with the --with-clanguage option, so
-  # only allow one item in the components list.
-  list(LENGTH ${PETSc_FIND_COMPONENTS} components_length)
-  if(${components_length} GREATER 1)
-    message(FATAL_ERROR "Only one component for PETSc is allowed to be specified")
-  endif()
-  list(FIND PETSC_VALID_COMPONENTS ${PETSc_FIND_COMPONENTS} component_location)
-  if(${component_location} EQUAL -1)
-    message(FATAL_ERROR "\"${PETSc_FIND_COMPONENTS}\" is not a valid PETSc component.")
-  else()
-    list(APPEND PETSC_LANGUAGE_BINDINGS ${PETSc_FIND_COMPONENTS})
-  endif()
-endif()
-
-if (PETSC_DIR AND PETSC_ARCH)
-  SET( PETSC_FOUND TRUE)
-else(PETSC_DIR AND PETSC_ARCH)
-  SET( PETSC_FOUND FALSE)
-endif(PETSC_DIR AND PETSC_ARCH)
-
-set (petsc_slaves LIBRARIES_SYS LIBRARIES_VEC LIBRARIES_MAT LIBRARIES_DM LIBRARIES_KSP LIBRARIES_SNES LIBRARIES_TS
-  INCLUDE_DIR INCLUDE_CONF)
-include (FindPackageMultipass)
-find_package_multipass (PETSc petsc_config_current
-  STATES DIR ARCH
-  DEPENDENTS INCLUDES LIBRARIES COMPILER MPIEXEC ${petsc_slaves})
-
-# Determine whether the PETSc layout is old-style (through 2.3.3) or
-# new-style (>= 3.0.0)
-if (EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h") # > 2.3.3
-  set (petsc_conf_rules "${PETSC_DIR}/conf/rules")
-  set (petsc_conf_variables "${PETSC_DIR}/conf/variables")
-elseif (EXISTS "${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h") # <= 2.3.3
-  set (petsc_conf_rules "${PETSC_DIR}/bmake/common/rules")
-  set (petsc_conf_variables "${PETSC_DIR}/bmake/common/variables")
-elseif (PETSC_DIR)
-  message (SEND_ERROR "The pair PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} do not specify a valid PETSc installation")
-endif ()
-
-if (petsc_conf_rules AND petsc_conf_variables AND NOT petsc_config_current)
-  petsc_get_version()
-
-  # Put variables into environment since they are needed to get
-  # configuration (petscvariables) in the PETSc makefile
-  set (ENV{PETSC_DIR} "${PETSC_DIR}")
-  set (ENV{PETSC_ARCH} "${PETSC_ARCH}")
-
-  # A temporary makefile to probe the PETSc configuration
-  set (petsc_config_makefile "${PROJECT_BINARY_DIR}/Makefile.petsc")
-  file (WRITE "${petsc_config_makefile}"
-    "## This file was autogenerated by FindPETSc.cmake
-# PETSC_DIR = ${PETSC_DIR}
-# PETSC_ARCH = ${PETSC_ARCH}
-include ${petsc_conf_rules}
-include ${petsc_conf_variables}
-show :
-	@echo -n \${\${VARIABLE}}
-")
-
-  macro (PETSC_GET_VARIABLE name var)
-    set (${var} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
-    execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} show VARIABLE=${name}
-      OUTPUT_VARIABLE ${var}
-      RESULT_VARIABLE petsc_return)
-  endmacro (PETSC_GET_VARIABLE)
-  petsc_get_variable (PETSC_LIB_DIR petsc_lib_dir)
-  petsc_get_variable (PETSC_EXTERNAL_LIB_BASIC petsc_libs_external)
-  petsc_get_variable (PETSC_CCPPFLAGS petsc_cpp_line)
-  petsc_get_variable (PETSC_INCLUDE petsc_include)
-  petsc_get_variable (PCC petsc_cc)
-  petsc_get_variable (MPIEXEC petsc_mpiexec)
-  # We are done with the temporary Makefile, calling PETSC_GET_VARIABLE after this point is invalid!
-  file (REMOVE ${petsc_config_makefile})
-
-  include (ResolveCompilerPaths)
-  # Extract include paths and libraries from compile command line
-  resolve_includes (petsc_includes_all "${petsc_cpp_line}")
-
-  macro (PETSC_FIND_LIBRARY suffix name)
-    set (PETSC_LIBRARY_${suffix} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) # Clear any stale value, if we got here, we need to find it again
-    find_library (PETSC_LIBRARY_${suffix} NAMES ${name} HINTS ${petsc_lib_dir} NO_DEFAULT_PATH)
-    set (PETSC_LIBRARIES_${suffix} "${PETSC_LIBRARY_${suffix}}")
-    mark_as_advanced (PETSC_LIBRARY_${suffix})
-  endmacro (PETSC_FIND_LIBRARY suffix name)
-
-  # Look for petscvec first, if it doesn't exist, we must be using single-library
-  petsc_find_library (VEC petscvec)
-  if (PETSC_LIBRARY_VEC)
-    petsc_find_library (SYS "petscsys;petsc") # libpetscsys is called libpetsc prior to 3.1 (when single-library was introduced)
-    petsc_find_library (MAT petscmat)
-    petsc_find_library (DM petscdm)
-    petsc_find_library (KSP petscksp)
-    petsc_find_library (SNES petscsnes)
-    petsc_find_library (TS petscts)
-    macro (PETSC_JOIN libs deps)
-      list (APPEND PETSC_LIBRARIES_${libs} ${PETSC_LIBRARIES_${deps}})
-    endmacro (PETSC_JOIN libs deps)
-    petsc_join (VEC SYS)
-    petsc_join (MAT VEC)
-    petsc_join (DM MAT)
-    petsc_join (KSP DM)
-    petsc_join (SNES KSP)
-    petsc_join (TS SNES)
-    petsc_join (ALL TS)
-  else ()
-    set (PETSC_LIBRARY_VEC "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) # There is no libpetscvec
-    petsc_find_library (SINGLE petsc)
-    foreach (pkg SYS VEC MAT DM KSP SNES TS ALL)
-      set (PETSC_LIBRARIES_${pkg} "${PETSC_LIBRARY_SINGLE}")
-    endforeach ()
-  endif ()
-  if (PETSC_LIBRARY_TS)
-    message (STATUS "Recognized PETSc install with separate libraries for each package")
-  else ()
-    message (STATUS "Recognized PETSc install with single library for all packages")
-  endif ()
-
-  include(Check${PETSC_LANGUAGE_BINDINGS}SourceRuns)
-  macro (PETSC_TEST_RUNS includes libraries runs)
-    if(${PETSC_LANGUAGE_BINDINGS} STREQUAL "C")
-      set(_PETSC_ERR_FUNC "CHKERRQ(ierr)")
-    elseif(${PETSC_LANGUAGE_BINDINGS} STREQUAL "CXX")
-      set(_PETSC_ERR_FUNC "CHKERRXX(ierr)")
-    endif()
-    if (PETSC_VERSION VERSION_GREATER 3.1)
-      set (_PETSC_TSDestroy "TSDestroy(&ts)")
-    else ()
-      set (_PETSC_TSDestroy "TSDestroy(ts)")
-    endif ()
-
-    set(_PETSC_TEST_SOURCE "
-static const char help[] = \"PETSc test program.\";
-#include <petscts.h>
-int main(int argc,char *argv[]) {
-PetscErrorCode ierr;
-TS ts;
-
-ierr = PetscInitialize(&argc,&argv,0,help);${_PETSC_ERR_FUNC};
-ierr = TSCreate(PETSC_COMM_WORLD,&ts);${_PETSC_ERR_FUNC};
-ierr = TSSetFromOptions(ts);${_PETSC_ERR_FUNC};
-ierr = ${_PETSC_TSDestroy};${_PETSC_ERR_FUNC};
-ierr = PetscFinalize();${_PETSC_ERR_FUNC};
-return 0;
-}
-")
-    multipass_source_runs ("${includes}" "${libraries}" "${_PETSC_TEST_SOURCE}" ${runs} "${PETSC_LANGUAGE_BINDINGS}")
-    if (${${runs}})
-      set (PETSC_EXECUTABLE_RUNS "YES" CACHE BOOL
-	"Can the system successfully run a PETSc executable? This variable can be manually set to \"YES\" to force CMake to accept a given PETSc configuration, but this will almost always result in a broken build. If you change PETSC_DIR, PETSC_ARCH, or PETSC_CURRENT you would have to reset this variable." FORCE)
-    endif (${${runs}})
-  endmacro (PETSC_TEST_RUNS)
-
-  find_path (PETSC_INCLUDE_DIR petscts.h HINTS "${PETSC_DIR}" PATH_SUFFIXES include NO_DEFAULT_PATH)
-  find_path (PETSC_INCLUDE_CONF petscconf.h HINTS "${PETSC_DIR}" PATH_SUFFIXES "${PETSC_ARCH}/include" "bmake/${PETSC_ARCH}" NO_DEFAULT_PATH)
-  mark_as_advanced (PETSC_INCLUDE_DIR PETSC_INCLUDE_CONF)
-  set (petsc_includes_minimal ${PETSC_INCLUDE_CONF} ${PETSC_INCLUDE_DIR})
-
-  petsc_test_runs ("${petsc_includes_minimal}" "${PETSC_LIBRARIES_TS}" petsc_works_minimal)
-  if (petsc_works_minimal)
-    message (STATUS "Minimal PETSc includes and libraries work. This probably means we are building with shared libs.")
-    set (petsc_includes_needed "${petsc_includes_minimal}")
-  else (petsc_works_minimal) # Minimal includes fail, see if just adding full includes fixes it
-    petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_allincludes)
-    if (petsc_works_allincludes) # It does, we just need all the includes (
-      message (STATUS "PETSc requires extra include paths, but links correctly with only interface libraries. This is an unexpected configuration (but it seems to work fine).")
-      set (petsc_includes_needed ${petsc_includes_all})
-    else (petsc_works_allincludes) # We are going to need to link the external libs explicitly
-      resolve_libraries (petsc_libraries_external "${petsc_libs_external}")
-      foreach (pkg SYS VEC MAT DM KSP SNES TS ALL)
-	list (APPEND PETSC_LIBRARIES_${pkg} ${petsc_libraries_external})
-      endforeach (pkg)
-      petsc_test_runs ("${petsc_includes_minimal}" "${PETSC_LIBRARIES_TS}" petsc_works_alllibraries)
-      if (petsc_works_alllibraries)
-	message (STATUS "PETSc only need minimal includes, but requires explicit linking to all dependencies. This is expected when PETSc is built with static libraries.")
-	set (petsc_includes_needed ${petsc_includes_minimal})
-      else (petsc_works_alllibraries)
-	# It looks like we really need everything, should have listened to Matt
-	set (petsc_includes_needed ${petsc_includes_all})
-	petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_all)
-	if (petsc_works_all) # We fail anyways
-	  message (STATUS "PETSc requires extra include paths and explicit linking to all dependencies. This probably means you have static libraries and something unexpected in PETSc headers.")
-	else (petsc_works_all) # We fail anyways
-	  message (STATUS "PETSc could not be used, maybe the install is broken.")
-	endif (petsc_works_all)
-      endif (petsc_works_alllibraries)
-    endif (petsc_works_allincludes)
-  endif (petsc_works_minimal)
-
-  # We do an out-of-source build so __FILE__ will be an absolute path, hence __INSDIR__ is superfluous
-  if (${PETSC_VERSION} VERSION_LESS 3.1)
-    set (PETSC_DEFINITIONS "-D__SDIR__=\"\"" CACHE STRING "PETSc definitions" FORCE)
-  else ()
-    set (PETSC_DEFINITIONS "-D__INSDIR__=" CACHE STRING "PETSc definitions" FORCE)
-  endif ()
-  # Sometimes this can be used to assist FindMPI.cmake
-  set (PETSC_MPIEXEC ${petsc_mpiexec} CACHE FILEPATH "Executable for running PETSc MPI programs" FORCE)
-  set (PETSC_INCLUDES ${petsc_includes_needed} CACHE STRING "PETSc include path" FORCE)
-  set (PETSC_LIBRARIES ${PETSC_LIBRARIES_ALL} CACHE STRING "PETSc libraries" FORCE)
-  set (PETSC_COMPILER ${petsc_cc} CACHE FILEPATH "PETSc compiler" FORCE)
-  # Note that we have forced values for all these choices. If you
-  # change these, you are telling the system to trust you that they
-  # work. It is likely that you will end up with a broken build.
-  mark_as_advanced (PETSC_INCLUDES PETSC_LIBRARIES PETSC_COMPILER PETSC_DEFINITIONS PETSC_MPIEXEC PETSC_EXECUTABLE_RUNS)
-endif ()
-
-########
-#  MESSAGE( "PETSC_DIR : ${PETSC_DIR}")
-#  MESSAGE( "PETSC_ARCH : ${PETSC_ARCH}")
-#  MESSAGE( "PETSC_FOUND : ${PETSC_FOUND}")
-#  MESSAGE( "PETSC_INCLUDES : ${PETSC_INCLUDES}")
-#  MESSAGE( "PETSC_LIBRARIES : ${PETSC_LIBRARIES}")
-#  MESSAGE( "PETSC_COMPILER : ${PETSC_COMPILER}")
-#  MESSAGE( "PETSC_DEFINITIONS : ${PETSC_DEFINITIONS}")
-#  MESSAGE( "PETSC_MPIEXEC : ${PETSC_MPIEXEC}")
-#  MESSAGE( "PETSC_VERSION : ${PETSC_VERSION}")
-#  MESSAGE( "PETSC_EXECUTABLE_RUNS : ${PETSC_EXECUTABLE_RUNS}")
-
-include (FindPackageHandleStandardArgs)
-find_package_handle_standard_args (PETSc
-  "PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH."
-  PETSC_INCLUDES PETSC_LIBRARIES PETSC_EXECUTABLE_RUNS)
diff --git a/modules/find/FindSCALAPACK.cmake b/modules/find/FindSCALAPACK.cmake
index 5a96239b5a903d84b4964eb56aa21f1967d11d0c..dec8a459ee550fd643600b4506bcceb788d08590 100644
--- a/modules/find/FindSCALAPACK.cmake
+++ b/modules/find/FindSCALAPACK.cmake
@@ -68,18 +68,18 @@ macro(Print_Find_Library_Blas_Status _libname _lib_to_find)
   else()
     if(${LIBNAME}_DIR)
       message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}"
-	"has not been found in ${ARGN}${ColourReset}")
+        "has not been found in ${ARGN}${ColourReset}")
     else()
       message("${Yellow}${_lib_to_find} not found."
-	"Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR"
-	"are defined so that we look for ${_lib_to_find} in"
-	"system paths (Linux: LD_LIBRARY_PATH, Windows: LIB,"
-	"Mac: DYLD_LIBRARY_PATH,"
-	"CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES,"
-	"CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}")
+        "Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR"
+        "are defined so that we look for ${_lib_to_find} in"
+        "system paths (Linux: LD_LIBRARY_PATH, Windows: LIB,"
+        "Mac: DYLD_LIBRARY_PATH,"
+        "CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES,"
+        "CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}")
       if(_lib_env)
-	message("${Yellow}${_lib_to_find} has not been found in"
-	  "${_lib_env}${ColourReset}")
+        message("${Yellow}${_lib_to_find} has not been found in"
+          "${_lib_env}${ColourReset}")
       endif()
     endif()
   endif()
@@ -145,11 +145,11 @@ macro(Check_Scalapack_Libraries LIBRARIES _prefix _name _flags _list _blaslapack
       list(APPEND _libdir "${BLAS_DIR}")
       list(APPEND _libdir "${BLAS_DIR}/lib")
       if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
-	list(APPEND _libdir "${BLAS_DIR}/lib64")
-	list(APPEND _libdir "${BLAS_DIR}/lib/intel64")
+        list(APPEND _libdir "${BLAS_DIR}/lib64")
+        list(APPEND _libdir "${BLAS_DIR}/lib/intel64")
       else()
-	list(APPEND _libdir "${BLAS_DIR}/lib32")
-	list(APPEND _libdir "${BLAS_DIR}/lib/ia32")
+        list(APPEND _libdir "${BLAS_DIR}/lib32")
+        list(APPEND _libdir "${BLAS_DIR}/lib/ia32")
       endif()
     elseif(ENV_BLAS_LIBDIR)
       list(APPEND _libdir "${ENV_BLAS_LIBDIR}")
@@ -157,11 +157,11 @@ macro(Check_Scalapack_Libraries LIBRARIES _prefix _name _flags _list _blaslapack
       list(APPEND _libdir "${ENV_BLAS_DIR}")
       list(APPEND _libdir "${ENV_BLAS_DIR}/lib")
       if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
-	list(APPEND _libdir "${ENV_BLAS_DIR}/lib64")
-	list(APPEND _libdir "${ENV_BLAS_DIR}/lib/intel64")
+        list(APPEND _libdir "${ENV_BLAS_DIR}/lib64")
+        list(APPEND _libdir "${ENV_BLAS_DIR}/lib/intel64")
       else()
-	list(APPEND _libdir "${ENV_BLAS_DIR}/lib32")
-	list(APPEND _libdir "${ENV_BLAS_DIR}/lib/ia32")
+        list(APPEND _libdir "${ENV_BLAS_DIR}/lib32")
+        list(APPEND _libdir "${ENV_BLAS_DIR}/lib/ia32")
       endif()
     endif()
     if (SCALAPACK_LIBDIR)
@@ -170,11 +170,11 @@ macro(Check_Scalapack_Libraries LIBRARIES _prefix _name _flags _list _blaslapack
       list(APPEND _libdir "${SCALAPACK_DIR}")
       list(APPEND _libdir "${SCALAPACK_DIR}/lib")
       if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
-	list(APPEND _libdir "${SCALAPACK_DIR}/lib64")
-	list(APPEND _libdir "${SCALAPACK_DIR}/lib/intel64")
+        list(APPEND _libdir "${SCALAPACK_DIR}/lib64")
+        list(APPEND _libdir "${SCALAPACK_DIR}/lib/intel64")
       else()
-	list(APPEND _libdir "${SCALAPACK_DIR}/lib32")
-	list(APPEND _libdir "${SCALAPACK_DIR}/lib/ia32")
+        list(APPEND _libdir "${SCALAPACK_DIR}/lib32")
+        list(APPEND _libdir "${SCALAPACK_DIR}/lib/ia32")
       endif()
     elseif(ENV_SCALAPACK_LIBDIR)
       list(APPEND _libdir "${ENV_SCALAPACK_LIBDIR}")
@@ -182,29 +182,29 @@ macro(Check_Scalapack_Libraries LIBRARIES _prefix _name _flags _list _blaslapack
       list(APPEND _libdir "${ENV_SCALAPACK_DIR}")
       list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib")
       if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
-	list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib64")
-	list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib/intel64")
+        list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib64")
+        list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib/intel64")
       else()
-	list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib32")
-	list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib/ia32")
+        list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib32")
+        list(APPEND _libdir "${ENV_SCALAPACK_DIR}/lib/ia32")
       endif()
     else()
       if (ENV_MKLROOT)
-	list(APPEND _libdir "${ENV_MKLROOT}/lib")
-	if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
-	  list(APPEND _libdir "${ENV_MKLROOT}/lib64")
-	  list(APPEND _libdir "${ENV_MKLROOT}/lib/intel64")
-	else()
-	  list(APPEND _libdir "${ENV_MKLROOT}/lib32")
-	  list(APPEND _libdir "${ENV_MKLROOT}/lib/ia32")
-	endif()
+        list(APPEND _libdir "${ENV_MKLROOT}/lib")
+        if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+          list(APPEND _libdir "${ENV_MKLROOT}/lib64")
+          list(APPEND _libdir "${ENV_MKLROOT}/lib/intel64")
+        else()
+          list(APPEND _libdir "${ENV_MKLROOT}/lib32")
+          list(APPEND _libdir "${ENV_MKLROOT}/lib/ia32")
+        endif()
       endif()
       if (WIN32)
-	string(REPLACE ":" ";" _libdir2 "$ENV{LIB}")
+        string(REPLACE ":" ";" _libdir2 "$ENV{LIB}")
       elseif (APPLE)
-	string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}")
+        string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}")
       else ()
-	string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}")
+        string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}")
       endif ()
       list(APPEND _libdir "${_libdir2}")
       list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
@@ -221,29 +221,29 @@ macro(Check_Scalapack_Libraries LIBRARIES _prefix _name _flags _list _blaslapack
 
     if(_libraries_work)
       if (BLA_STATIC)
-	if (WIN32)
-	  set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
-	endif ( WIN32 )
-	if (APPLE)
-	  set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
-	else (APPLE)
-	  set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
-	endif (APPLE)
+        if (WIN32)
+          set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+        endif ( WIN32 )
+        if (APPLE)
+          set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+        else (APPLE)
+          set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+        endif (APPLE)
       else (BLA_STATIC)
-	if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
-	  # for ubuntu's libblas3gf and libscalapack3gf packages
-	  set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
-	endif ()
+        if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+          # for ubuntu's libblas3gf and libscalapack3gf packages
+          set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
+        endif ()
       endif (BLA_STATIC)
       find_library(${_prefix}_${_library}_LIBRARY
-	NAMES ${_library}
-	HINTS ${_libdir}
-	)
+        NAMES ${_library}
+        HINTS ${_libdir}
+        )
       mark_as_advanced(${_prefix}_${_library}_LIBRARY)
       # Print status if not found
       # -------------------------
       if (NOT ${_prefix}_${_library}_LIBRARY AND NOT SCALAPACK_FIND_QUIETLY AND SCALAPACK_VERBOSE)
-	Print_Find_Library_Blas_Status(scalapack ${_library} ${_libdir})
+        Print_Find_Library_Blas_Status(scalapack ${_library} ${_libdir})
       endif ()
       set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
       set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
@@ -259,7 +259,7 @@ macro(Check_Scalapack_Libraries LIBRARIES _prefix _name _flags _list _blaslapack
     endif(UNIX AND BLA_STATIC)
     if (SCALAPACK_VERBOSE)
       message("${Cyan}SCALAPACK libs found. Try to compile symbol ${_name} with"
-	"following libraries: ${CMAKE_REQUIRED_LIBRARIES}")
+        "following libraries: ${CMAKE_REQUIRED_LIBRARIES}")
     endif ()
     if(NOT SCALAPACK_FOUND)
       unset(${_prefix}${_combined_name}_WORKS CACHE)
@@ -322,84 +322,96 @@ if(BLAS_FOUND AND LAPACK_FOUND AND MPI_FOUND)
     endif(NOT BLA_VENDOR)
   endif ($ENV{BLA_VENDOR} MATCHES ".+")
 
-  # Generic SCALAPACK library
-  if (BLA_VENDOR STREQUAL "Generic" OR
-      BLA_VENDOR STREQUAL "All")
-    if ( NOT SCALAPACK_LIBRARIES )
-      check_scalapack_libraries(
-	SCALAPACK_LIBRARIES
-	SCALAPACK
-	pdgemm
-	""
-	"scalapack" # scalapack lib to look for
-	"${LAPACK_LIBRARIES};${BLAS_LIBRARIES}" # blas and lapack libs
-	"${MPI_Fortran_LIBRARIES}" # mpi libs
-	""          # threads libs
-	)
-    endif ( NOT SCALAPACK_LIBRARIES )
-  endif ()
   #intel scalapack
   if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
     if (UNIX AND NOT WIN32)
       find_library(M_LIBRARY NAMES m)
       mark_as_advanced(M_LIBRARY)
       if(M_LIBRARY)
-	set(LM "-lm")
+        set(LM "-lm")
       else()
-	set(LM "")
+        set(LM "")
       endif()
     endif ()
     if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
       if(SCALAPACK_FIND_QUIETLY OR NOT SCALAPACK_FIND_REQUIRED)
-	find_PACKAGE(Threads)
+        find_PACKAGE(Threads)
       else()
-	find_package(Threads REQUIRED)
+        find_package(Threads REQUIRED)
       endif()
 
       set(SCALAPACK_SEARCH_LIBS "")
 
       if (BLA_F95)
-	set(SCALAPACK_mkl_SEARCH_SYMBOL "PDGEMM")
-	set(_LIBRARIES SCALAPACK95_LIBRARIES)
-	set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES})
-	list(APPEND SCALAPACK_SEARCH_LIBS "mkl_scalapack_lp64")
+        set(SCALAPACK_mkl_SEARCH_SYMBOL "PDGEMM")
+        set(_LIBRARIES SCALAPACK95_LIBRARIES)
+        set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES})
+        list(APPEND SCALAPACK_SEARCH_LIBS "mkl_scalapack_lp64")
       else()
-	set(SCALAPACK_mkl_SEARCH_SYMBOL "pdgemm")
-	set(_LIBRARIES SCALAPACK_LIBRARIES)
-	set(_BLAS_LIBRARIES ${BLAS_LIBRARIES})
-	list(APPEND SCALAPACK_SEARCH_LIBS "mkl_scalapack_lp64")
+        set(SCALAPACK_mkl_SEARCH_SYMBOL "pdgemm")
+        set(_LIBRARIES SCALAPACK_LIBRARIES)
+        set(_BLAS_LIBRARIES ${BLAS_LIBRARIES})
+        list(APPEND SCALAPACK_SEARCH_LIBS "mkl_scalapack_lp64")
       endif()
 
       # First try empty scalapack libs
       if (NOT ${_LIBRARIES})
-	check_scalapack_libraries(
-	  ${_LIBRARIES}
-	  BLAS
-	  ${SCALAPACK_mkl_SEARCH_SYMBOL}
-	  ""
-	  ""
-	  "${_BLAS_LIBRARIES}"
-	  ""
-	  "${MPI_Fortran_LIBRARIES}"
-	  )
+        check_scalapack_libraries(
+          ${_LIBRARIES}
+          BLAS
+          ${SCALAPACK_mkl_SEARCH_SYMBOL}
+          ""
+          ""
+          "${_BLAS_LIBRARIES}"
+          ""
+          "${MPI_Fortran_LIBRARIES}"
+          )
       endif ()
       # Then try the search libs
       foreach (IT ${SCALAPACK_SEARCH_LIBS})
-	if (NOT ${_LIBRARIES})
-	  check_scalapack_libraries(
-	    ${_LIBRARIES}
-	    BLAS
-	    ${SCALAPACK_mkl_SEARCH_SYMBOL}
-	    ""
-	    "${IT};mkl_blacs_intelmpi_lp64"
-	    "${_BLAS_LIBRARIES}"
-	    ""
-	    "${MPI_Fortran_LIBRARIES}"
-	    )
-	endif ()
+        if (NOT ${_LIBRARIES})
+          check_scalapack_libraries(
+            ${_LIBRARIES}
+            BLAS
+            ${SCALAPACK_mkl_SEARCH_SYMBOL}
+            ""
+            "${IT};mkl_blacs_intelmpi_lp64"
+            "${_BLAS_LIBRARIES}"
+            ""
+            "${MPI_Fortran_LIBRARIES}"
+            )
+        endif ()
       endforeach ()
     endif ()
   endif()
+  # Generic SCALAPACK library
+  if (BLA_VENDOR STREQUAL "Generic" OR
+      BLA_VENDOR STREQUAL "All")
+    if ( NOT SCALAPACK_LIBRARIES )
+      check_scalapack_libraries(
+        SCALAPACK_LIBRARIES
+        SCALAPACK
+        pdgemm
+        ""
+        "scalapack" # scalapack lib to look for
+        "${LAPACK_LIBRARIES};${BLAS_LIBRARIES}" # blas and lapack libs
+        "${MPI_Fortran_LIBRARIES}" # mpi libs
+        ""          # threads libs
+        )
+    endif ( NOT SCALAPACK_LIBRARIES )
+    if ( NOT SCALAPACK_LIBRARIES )
+      check_scalapack_libraries(
+        SCALAPACK_LIBRARIES
+        SCALAPACK
+        pdgemm
+        ""
+        "scalapack-openmpi" # scalapack lib to look for
+        "${LAPACK_LIBRARIES};${BLAS_LIBRARIES}" # blas and lapack libs
+        "${MPI_Fortran_LIBRARIES}" # mpi libs
+        ""          # threads libs
+        )
+    endif ( NOT SCALAPACK_LIBRARIES )
+  endif ()
 else(BLAS_FOUND AND LAPACK_FOUND AND MPI_FOUND)
   message(STATUS "SCALAPACK requires BLAS, LAPACK, and MPI")
 endif(BLAS_FOUND AND LAPACK_FOUND AND MPI_FOUND)
@@ -416,23 +428,23 @@ if(BLA_F95)
       message(STATUS "SCALAPACK_LIBRARIES ${SCALAPACK_LIBRARIES}")
     else(SCALAPACK95_FOUND)
       message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but SCALAPACK 95 libraries could not be found or check of symbols failed."
-	"\nPlease indicate where to find SCALAPACK libraries. You have three options:\n"
-	"- Option 1: Provide the installation directory of SCALAPACK library with cmake option: -DSCALAPACK_DIR=your/path/to/scalapack\n"
-	"- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
-	"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
-	"\nTo follow libraries detection more precisely you can activate a verbose mode with -DSCALAPACK_VERBOSE=ON at cmake configure."
-	"\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."
-	"\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"
-	"Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
-	"Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
+        "\nPlease indicate where to find SCALAPACK libraries. You have three options:\n"
+        "- Option 1: Provide the installation directory of SCALAPACK library with cmake option: -DSCALAPACK_DIR=your/path/to/scalapack\n"
+        "- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
+        "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
+        "\nTo follow libraries detection more precisely you can activate a verbose mode with -DSCALAPACK_VERBOSE=ON at cmake configure."
+        "\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."
+        "\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"
+        "Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
+        "Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
       if(SCALAPACK_FIND_REQUIRED)
-	message(FATAL_ERROR
-	  "A required library with SCALAPACK95 API not found. Please specify library location."
-	  )
+        message(FATAL_ERROR
+          "A required library with SCALAPACK95 API not found. Please specify library location."
+          )
       else(SCALAPACK_FIND_REQUIRED)
-	message(STATUS
-	  "A library with SCALAPACK95 API not found. Please specify library location."
-	  )
+        message(STATUS
+          "A library with SCALAPACK95 API not found. Please specify library location."
+          )
       endif(SCALAPACK_FIND_REQUIRED)
     endif(SCALAPACK95_FOUND)
   endif(NOT SCALAPACK_FIND_QUIETLY)
@@ -451,23 +463,23 @@ else(BLA_F95)
       message(STATUS "SCALAPACK_LIBRARIES ${SCALAPACK_LIBRARIES}")
     else(SCALAPACK_FOUND)
       message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but SCALAPACK libraries could not be found or check of symbols failed."
-	"\nPlease indicate where to find SCALAPACK libraries. You have three options:\n"
-	"- Option 1: Provide the installation directory of SCALAPACK library with cmake option: -DSCALAPACK_DIR=your/path/to/scalapack\n"
-	"- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
-	"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
-	"\nTo follow libraries detection more precisely you can activate a verbose mode with -DSCALAPACK_VERBOSE=ON at cmake configure."
-	"\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."
-	"\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"
-	"Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
-	"Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
+        "\nPlease indicate where to find SCALAPACK libraries. You have three options:\n"
+        "- Option 1: Provide the installation directory of SCALAPACK library with cmake option: -DSCALAPACK_DIR=your/path/to/scalapack\n"
+        "- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
+        "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
+        "\nTo follow libraries detection more precisely you can activate a verbose mode with -DSCALAPACK_VERBOSE=ON at cmake configure."
+        "\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."
+        "\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"
+        "Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
+        "Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
       if(SCALAPACK_FIND_REQUIRED)
-	message(FATAL_ERROR
-	  "A required library with SCALAPACK API not found. Please specify library location."
-	  )
+        message(FATAL_ERROR
+          "A required library with SCALAPACK API not found. Please specify library location."
+          )
       else(SCALAPACK_FIND_REQUIRED)
-	message(STATUS
-	  "A library with SCALAPACK API not found. Please specify library location."
-	  )
+        message(STATUS
+          "A library with SCALAPACK API not found. Please specify library location."
+          )
       endif(SCALAPACK_FIND_REQUIRED)
     endif(SCALAPACK_FOUND)
   endif(NOT SCALAPACK_FIND_QUIETLY)
diff --git a/modules/find/FindSTARPU.cmake b/modules/find/FindSTARPU.cmake
index adf884a3823286148c4dd76a46e85619a03bbb3d..d09bb0fbd0afa3107aa70f7f18160c8c40714a39 100644
--- a/modules/find/FindSTARPU.cmake
+++ b/modules/find/FindSTARPU.cmake
@@ -3,7 +3,7 @@
 # @copyright (c) 2009-2014 The University of Tennessee and The University
 #                          of Tennessee Research Foundation.
 #                          All rights reserved.
-# @copyright (c) 2012-2015 Inria. All rights reserved.
+# @copyright (c) 2012-2017 Inria. All rights reserved.
 # @copyright (c) 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
 #
 ###
@@ -39,7 +39,7 @@
 #  STARPU_INCLUDE_DIRS_DEP       - starpu + dependencies include directories
 #  STARPU_LIBRARY_DIRS_DEP       - starpu + dependencies link directories
 #  STARPU_LIBRARIES_DEP          - starpu libraries + dependencies
-#  STARPU_VERSION_STRING         - A human-readable string containing the version of the package found
+#  STARPU_VERSION                - A human-readable string containing the version of the package found
 #  STARPU_VERSION_MAJOR          - The major version of the package found
 #  STARPU_VERSION_MINOR          - The minor version of the package found
 # The user can give specific paths where to find the libraries adding cmake
@@ -55,7 +55,7 @@
 # Copyright 2012-2013 Emmanuel Agullo
 # Copyright 2012-2013 Mathieu Faverge
 # Copyright 2012      Cedric Castagnede
-# Copyright 2013      Florent Pruvost
+# Copyright 2013-2017 Florent Pruvost
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file MORSE-Copyright.txt for details.
@@ -211,11 +211,18 @@ find_package(PkgConfig QUIET)
 
 if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER)
 
-  pkg_search_module(STARPU_SHM libstarpu)
+  set (STARPU_VERSION_LIST "1.3;1.2;1.1;1.0")
+  foreach(_version ${STARPU_VERSION_LIST})
+    pkg_search_module(STARPU_SHM starpu-${_version})
+    if (STARPU_SHM_FOUND)
+      set(STARPU_VERSION "${_version}" CACHE INTERNAL "StarPU version found")
+      break()
+    endif()
+  endforeach()
   set(STARPU_INCLUDE_DIRS "${STARPU_SHM_STATIC_INCLUDE_DIRS}")
   set(STARPU_LIBRARY_DIRS "${STARPU_SHM_STATIC_LIBRARY_DIRS}")
   if(STARPU_LOOK_FOR_MPI AND MPI_FOUND)
-    pkg_search_module(STARPU_MPI libstarpumpi)
+    pkg_search_module(STARPU_MPI starpumpi-${STARPU_VERSION})
   endif()
   if (NOT STARPU_FIND_QUIETLY)
     if (STARPU_SHM_FOUND AND STARPU_SHM_LIBRARIES)
@@ -231,39 +238,41 @@ if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER)
       list(GET STARPU_VERSION_STRING_LIST 1 STARPU_VERSION_MINOR)
     else()
       message(STATUS "${Magenta}Looking for STARPU - not found using PkgConfig."
-	"\n   Perhaps you should add the directory containing libstarpu.pc"
-	"\n   to the PKG_CONFIG_PATH environment variable.${ColourReset}")
+        "\n   Perhaps you should add the directory containing libstarpu.pc"
+        "\n   to the PKG_CONFIG_PATH environment variable.${ColourReset}")
     endif()
     if (STARPU_LOOK_FOR_MPI)
       if (STARPU_MPI_FOUND AND STARPU_MPI_LIBRARIES)
-	message(STATUS "Looking for STARPU MPI - found using PkgConfig")
+        message(STATUS "Looking for STARPU MPI - found using PkgConfig")
       else()
-	message(STATUS "${Magenta}Looking for STARPU MPI - not found using PkgConfig."
-	  " Perhaps you should add the directory containing libstarpumpi.pc to"
-	  " the PKG_CONFIG_PATH environment variable.${ColourReset}")
+        message(STATUS "${Magenta}Looking for STARPU MPI - not found using PkgConfig."
+          " Perhaps you should add the directory containing libstarpumpi.pc to"
+          " the PKG_CONFIG_PATH environment variable.${ColourReset}")
       endif()
     endif()
-  endif()
 
-  if (STARPU_FIND_VERSION_EXACT)
-    if( NOT (STARPU_FIND_VERSION_MAJOR STREQUAL STARPU_VERSION_MAJOR) OR
-	NOT (STARPU_FIND_VERSION_MINOR STREQUAL STARPU_VERSION_MINOR) )
-      if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY)
-	message(FATAL_ERROR
-	  "STARPU version found is ${STARPU_VERSION_STRING}"
-	  " when required is ${STARPU_FIND_VERSION}")
+    # check if the version found respects the minimum required
+    if (STARPU_FIND_VERSION_EXACT)
+      if( NOT (STARPU_FIND_VERSION_MAJOR STREQUAL STARPU_VERSION_MAJOR) OR
+         NOT (STARPU_FIND_VERSION_MINOR STREQUAL STARPU_VERSION_MINOR) )
+        if(NOT STARPU_FIND_QUIETLY)
+         message(WARNING
+           "STARPU version found is ${STARPU_VERSION}"
+           " when required is ${STARPU_FIND_VERSION}")
+        endif()
       endif()
-    endif()
-  else()
-    # if the version found is older than the required then error
-    if( (STARPU_FIND_VERSION_MAJOR STRGREATER STARPU_VERSION_MAJOR) OR
-	(STARPU_FIND_VERSION_MINOR STRGREATER STARPU_VERSION_MINOR) )
-      if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY)
-	message(FATAL_ERROR
-	  "STARPU version found is ${STARPU_VERSION_STRING}"
-	  " when required is ${STARPU_FIND_VERSION} or newer")
+    else()
+      # if the version found is older than the required then error
+      if( (STARPU_FIND_VERSION_MAJOR STRGREATER STARPU_VERSION_MAJOR) OR
+         (STARPU_FIND_VERSION_MINOR STRGREATER STARPU_VERSION_MINOR) )
+        if(NOT STARPU_FIND_QUIETLY)
+         message(WARNING
+           "STARPU version found is ${STARPU_VERSION}"
+           " when required is ${STARPU_FIND_VERSION} or newer")
+        endif()
       endif()
     endif()
+
   endif()
 
   if(STARPU_MPI_LIBRARIES)
@@ -343,33 +352,33 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
     foreach(starpu_hdr ${STARPU_hdrs_to_find})
       set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND")
       find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS
-	NAMES ${starpu_hdr}
-	HINTS ${STARPU_INCDIR})
+        NAMES ${starpu_hdr}
+        HINTS ${STARPU_INCDIR})
     endforeach()
   else()
     if(STARPU_DIR)
       foreach(starpu_hdr ${STARPU_hdrs_to_find})
-	set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND")
-	find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS
-	  NAMES ${starpu_hdr}
-	  HINTS ${STARPU_DIR}
-	  PATH_SUFFIXES "include"
-	  "include/starpu/1.0"
-	  "include/starpu/1.1"
-	  "include/starpu/1.2"
-	  "include/starpu/1.3")
+        set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND")
+        find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS
+          NAMES ${starpu_hdr}
+          HINTS ${STARPU_DIR}
+          PATH_SUFFIXES "include"
+          "include/starpu/1.0"
+          "include/starpu/1.1"
+          "include/starpu/1.2"
+          "include/starpu/1.3")
       endforeach()
     else()
       foreach(starpu_hdr ${STARPU_hdrs_to_find})
-	set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND")
-	find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS
-	  NAMES ${starpu_hdr}
-	  HINTS ${_inc_env}
-	  PATH_SUFFIXES
-	  "starpu/1.0"
-	  "starpu/1.1"
-	  "starpu/1.2"
-	  "starpu/1.3")
+        set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND")
+        find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS
+          NAMES ${starpu_hdr}
+          HINTS ${_inc_env}
+          PATH_SUFFIXES
+          "starpu/1.0"
+          "starpu/1.1"
+          "starpu/1.2"
+          "starpu/1.3")
       endforeach()
     endif()
   endif()
@@ -390,8 +399,8 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
     string(REGEX REPLACE
       "(.*)define([ \t]*)${_PACKAGE}_MINOR_VERSION([ \t]*)([0-9]+)(.*)"
       "\\4" ${_PACKAGE}_VERSION_MINOR "${_file}")
-    set(${_PACKAGE}_VERSION_STRING
-      "${${_PACKAGE}_VERSION_MAJOR}.${${_PACKAGE}_VERSION_MINOR}" CACHE PATH "StarPU version found in starpu_config.h")
+    set(${_PACKAGE}_VERSION
+      "${${_PACKAGE}_VERSION_MAJOR}.${${_PACKAGE}_VERSION_MINOR}" CACHE INTERNAL "StarPU version found")
     #message(STATUS "${_PACKAGE}_VERSION_MAJOR = -${${_PACKAGE}_VERSION_MAJOR}-")
     #message(STATUS "${_PACKAGE}_VERSION_MINOR = -${${_PACKAGE}_VERSION_MINOR}-")
 
@@ -403,40 +412,40 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
     GET_VERSION("STARPU" "${STARPU_starpu_config.h_INCLUDE_DIRS}/starpu_config.h")
     if (STARPU_VERSION_MAJOR AND STARPU_VERSION_MINOR)
       if (STARPU_FIND_VERSION_EXACT)
-	if (STARPU_FIND_VERSION_MAJOR AND STARPU_FIND_VERSION_MINOR)
-	  if( NOT (STARPU_FIND_VERSION_MAJOR STREQUAL STARPU_VERSION_MAJOR) OR
-	      NOT (STARPU_FIND_VERSION_MINOR STREQUAL STARPU_VERSION_MINOR) )
-	    if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY)
-	      message(FATAL_ERROR
-		"STARPU version found is ${STARPU_VERSION_STRING} "
-		"when required is ${STARPU_FIND_VERSION}")
-	    endif()
-	  endif()
-	endif()
+        if (STARPU_FIND_VERSION_MAJOR AND STARPU_FIND_VERSION_MINOR)
+          if( NOT (STARPU_FIND_VERSION_MAJOR STREQUAL STARPU_VERSION_MAJOR) OR
+              NOT (STARPU_FIND_VERSION_MINOR STREQUAL STARPU_VERSION_MINOR) )
+            if(NOT STARPU_FIND_QUIETLY)
+              message(WARNING
+                "STARPU version found is ${STARPU_VERSION} "
+                "when required is ${STARPU_FIND_VERSION}")
+            endif()
+          endif()
+        endif()
       else()
-	if (STARPU_FIND_VERSION_MAJOR AND STARPU_FIND_VERSION_MINOR)
-	  # if the version found is older than the required then error
-	  if( (STARPU_FIND_VERSION_MAJOR STRGREATER STARPU_VERSION_MAJOR) OR
-	      (STARPU_FIND_VERSION_MINOR STRGREATER STARPU_VERSION_MINOR) )
-	    if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY)
-	      message(FATAL_ERROR
-		"STARPU version found is ${STARPU_VERSION_STRING} "
-		"when required is ${STARPU_FIND_VERSION} or newer")
-	    endif()
-	  endif()
-	endif()
+        if (STARPU_FIND_VERSION_MAJOR AND STARPU_FIND_VERSION_MINOR)
+          # if the version found is older than the required then error
+          if( (STARPU_FIND_VERSION_MAJOR STRGREATER STARPU_VERSION_MAJOR) OR
+              (STARPU_FIND_VERSION_MINOR STRGREATER STARPU_VERSION_MINOR) )
+            if(NOT STARPU_FIND_QUIETLY)
+              message(WARNING
+                "STARPU version found is ${STARPU_VERSION} "
+                "when required is ${STARPU_FIND_VERSION} or newer")
+            endif()
+          endif()
+        endif()
       endif()
     else()
-      if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY)
-	message(FATAL_ERROR
-	  "STARPU version has not been found using starpu_config.h"
-	  " located in ${STARPU_starpu_config.h_INCLUDE_DIRS}")
+      if(STARPU_FIND_REQUIRED)
+        message(FATAL_ERROR
+          "STARPU version has not been found using starpu_config.h"
+          " located in ${STARPU_starpu_config.h_INCLUDE_DIRS}")
       endif()
     endif()
   else()
-    if(STARPU_FIND_REQUIRED AND NOT STARPU_FIND_QUIETLY)
+    if(STARPU_FIND_REQUIRED)
       message(FATAL_ERROR
-	"starpu_config.h has not been found while required to get StarPU version")
+        "starpu_config.h has not been found while required to get StarPU version")
     endif()
   endif()
 
@@ -458,33 +467,33 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
     foreach(starpu_hdr ${STARPU_hdrs_to_find})
       set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND")
       find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS
-	NAMES ${starpu_hdr}
-	HINTS ${STARPU_INCDIR})
+        NAMES ${starpu_hdr}
+        HINTS ${STARPU_INCDIR})
     endforeach()
   else()
     if(STARPU_DIR)
       set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND")
       foreach(starpu_hdr ${STARPU_hdrs_to_find})
-	find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS
-	  NAMES ${starpu_hdr}
-	  HINTS ${STARPU_DIR}
-	  PATH_SUFFIXES "include"
-	  "include/starpu/1.0"
-	  "include/starpu/1.1"
-	  "include/starpu/1.2"
-	  "include/starpu/1.3")
+        find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS
+          NAMES ${starpu_hdr}
+          HINTS ${STARPU_DIR}
+          PATH_SUFFIXES "include"
+          "include/starpu/1.0"
+          "include/starpu/1.1"
+          "include/starpu/1.2"
+          "include/starpu/1.3")
       endforeach()
     else()
       foreach(starpu_hdr ${STARPU_hdrs_to_find})
-	set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND")
-	find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS
-	  NAMES ${starpu_hdr}
-	  HINTS ${_inc_env}
-	  PATH_SUFFIXES
-	  "starpu/1.0"
-	  "starpu/1.1"
-	  "starpu/1.2"
-	  "starpu/1.3")
+        set(STARPU_${starpu_hdr}_INCLUDE_DIRS "STARPU_${starpu_hdr}_INCLUDE_DIRS-NOTFOUND")
+        find_path(STARPU_${starpu_hdr}_INCLUDE_DIRS
+          NAMES ${starpu_hdr}
+          HINTS ${_inc_env}
+          PATH_SUFFIXES
+          "starpu/1.0"
+          "starpu/1.1"
+          "starpu/1.2"
+          "starpu/1.3")
       endforeach()
     endif()
   endif()
@@ -499,24 +508,24 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
       list(APPEND STARPU_INCLUDE_DIRS "${STARPU_${starpu_hdr}_INCLUDE_DIRS}" )
     else ()
       if(NOT STARPU_FIND_QUIETLY)
-	message(STATUS "Looking for starpu -- ${starpu_hdr} not found")
+        message(STATUS "Looking for starpu -- ${starpu_hdr} not found")
       endif()
       if(starpu_hdr STREQUAL "starpu_mpi.h")
-	if(NOT STARPU_FIND_REQUIRED_MPI)
-	  if (NOT STARPU_FIND_QUIETLY)
-	    message(STATUS "Looking for starpu -- ${starpu_hdr} not required")
-	  endif()
-	else()
-	  list(APPEND STARPU_INCLUDE_DIRS "${STARPU_${starpu_hdr}_INCLUDE_DIRS}" )
-	endif()
+        if(NOT STARPU_FIND_REQUIRED_MPI)
+          if (NOT STARPU_FIND_QUIETLY)
+            message(STATUS "Looking for starpu -- ${starpu_hdr} not required")
+          endif()
+        else()
+          list(APPEND STARPU_INCLUDE_DIRS "${STARPU_${starpu_hdr}_INCLUDE_DIRS}" )
+        endif()
       elseif( (starpu_hdr STREQUAL "starpu_cuda.h") OR (starpu_hdr STREQUAL "starpu_scheduler.h") )
-	if(NOT STARPU_FIND_REQUIRED_CUDA)
-	  if (NOT STARPU_FIND_QUIETLY)
-	    message(STATUS "Looking for starpu -- ${starpu_hdr} not required")
-	  endif()
-	else()
-	  list(APPEND STARPU_INCLUDE_DIRS "${STARPU_${starpu_hdr}_INCLUDE_DIRS}" )
-	endif()
+        if(NOT STARPU_FIND_REQUIRED_CUDA)
+          if (NOT STARPU_FIND_QUIETLY)
+            message(STATUS "Looking for starpu -- ${starpu_hdr} not required")
+          endif()
+        else()
+          list(APPEND STARPU_INCLUDE_DIRS "${STARPU_${starpu_hdr}_INCLUDE_DIRS}" )
+        endif()
       endif()
     endif ()
     mark_as_advanced(STARPU_${starpu_hdr}_INCLUDE_DIRS)
@@ -546,15 +555,15 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
       list(APPEND _lib_env "${ENV_STARPU_DIR}/lib")
     else()
       if(WIN32)
-	string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
+        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}")
+        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)
@@ -563,37 +572,37 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
     # ----------------------------------------------
 
     # create list of libs to find
-    set(STARPU_libs_to_find     "starpu-${STARPU_VERSION_STRING}")
-    set(STARPU_SHM_libs_to_find "starpu-${STARPU_VERSION_STRING}")
+    set(STARPU_libs_to_find     "starpu-${STARPU_VERSION}")
+    set(STARPU_SHM_libs_to_find "starpu-${STARPU_VERSION}")
     if (STARPU_LOOK_FOR_MPI OR MPI_FOUND)
-      list(INSERT STARPU_libs_to_find 0 "starpumpi-${STARPU_VERSION_STRING}")
+      list(INSERT STARPU_libs_to_find 0 "starpumpi-${STARPU_VERSION}")
       set(STARPU_MPI_libs_to_find "${STARPU_libs_to_find}")
     endif()
 
     # call cmake macro to find the lib path
     if(STARPU_LIBDIR)
       foreach(starpu_lib ${STARPU_libs_to_find})
-	set(STARPU_${starpu_lib}_LIBRARY "STARPU_${starpu_lib}_LIBRARY-NOTFOUND")
-	find_library(STARPU_${starpu_lib}_LIBRARY
-	  NAMES ${starpu_lib}
-	  HINTS ${STARPU_LIBDIR})
+        set(STARPU_${starpu_lib}_LIBRARY "STARPU_${starpu_lib}_LIBRARY-NOTFOUND")
+        find_library(STARPU_${starpu_lib}_LIBRARY
+          NAMES ${starpu_lib}
+          HINTS ${STARPU_LIBDIR})
       endforeach()
     else()
       if(STARPU_DIR)
-	foreach(starpu_lib ${STARPU_libs_to_find})
-	  set(STARPU_${starpu_lib}_LIBRARY "STARPU_${starpu_lib}_LIBRARY-NOTFOUND")
-	  find_library(STARPU_${starpu_lib}_LIBRARY
-	    NAMES ${starpu_lib}
-	    HINTS ${STARPU_DIR}
-	    PATH_SUFFIXES lib lib32 lib64)
-	endforeach()
+        foreach(starpu_lib ${STARPU_libs_to_find})
+          set(STARPU_${starpu_lib}_LIBRARY "STARPU_${starpu_lib}_LIBRARY-NOTFOUND")
+          find_library(STARPU_${starpu_lib}_LIBRARY
+            NAMES ${starpu_lib}
+            HINTS ${STARPU_DIR}
+            PATH_SUFFIXES lib lib32 lib64)
+        endforeach()
       else()
-	foreach(starpu_lib ${STARPU_libs_to_find})
-	  set(STARPU_${starpu_lib}_LIBRARY "STARPU_${starpu_lib}_LIBRARY-NOTFOUND")
-	  find_library(STARPU_${starpu_lib}_LIBRARY
-	    NAMES ${starpu_lib}
-	    HINTS ${_lib_env})
-	endforeach()
+        foreach(starpu_lib ${STARPU_libs_to_find})
+          set(STARPU_${starpu_lib}_LIBRARY "STARPU_${starpu_lib}_LIBRARY-NOTFOUND")
+          find_library(STARPU_${starpu_lib}_LIBRARY
+            NAMES ${starpu_lib}
+            HINTS ${_lib_env})
+        endforeach()
       endif()
     endif()
 
@@ -603,49 +612,49 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
 
       if (STARPU_${starpu_lib}_LIBRARY)
 
-	get_filename_component(${starpu_lib}_lib_path ${STARPU_${starpu_lib}_LIBRARY} PATH)
-	# set cmake variables (respects naming convention)
-
-	foreach(starpu_shm_lib ${STARPU_SHM_libs_to_find})
-	  if(starpu_shm_lib STREQUAL starpu_lib)
-	    list(APPEND STARPU_SHM_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}")
-	  endif()
-	endforeach()
-	if (STARPU_LOOK_FOR_MPI AND MPI_FOUND)
-	  foreach(starpu_mpi_lib ${STARPU_MPI_libs_to_find})
-	    if(starpu_mpi_lib STREQUAL starpu_lib)
-	      list(APPEND STARPU_MPI_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}")
-	    endif()
-	  endforeach()
-	endif ()
-	list(APPEND STARPU_LIBRARY_DIRS "${${starpu_lib}_lib_path}")
+        get_filename_component(${starpu_lib}_lib_path ${STARPU_${starpu_lib}_LIBRARY} PATH)
+        # set cmake variables (respects naming convention)
+
+        foreach(starpu_shm_lib ${STARPU_SHM_libs_to_find})
+          if(starpu_shm_lib STREQUAL starpu_lib)
+            list(APPEND STARPU_SHM_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}")
+          endif()
+        endforeach()
+        if (STARPU_LOOK_FOR_MPI AND MPI_FOUND)
+          foreach(starpu_mpi_lib ${STARPU_MPI_libs_to_find})
+            if(starpu_mpi_lib STREQUAL starpu_lib)
+              list(APPEND STARPU_MPI_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}")
+            endif()
+          endforeach()
+        endif ()
+        list(APPEND STARPU_LIBRARY_DIRS "${${starpu_lib}_lib_path}")
 
       else (STARPU_${starpu_lib}_LIBRARY)
 
-	if(NOT STARPU_FIND_QUIETLY)
-	  message(STATUS "Looking for starpu -- lib ${starpu_lib} not found")
-	endif()
-	if(starpu_lib STREQUAL "starpumpi-${STARPU_VERSION_STRING}" AND
-	    NOT STARPU_FIND_REQUIRED_MPI)
-	  # if MPI optional, not a problem: no NOTFOUND in list of MPI LIBRARIES
-	  if(NOT STARPU_FIND_QUIETLY)
-	    message(STATUS "Looking for starpu -- lib ${starpu_lib} not required")
-	  endif()
-	else()
-	  # for any other lib, add NOTFOUND in the proper list of LIBRARIES
-	  foreach(starpu_shm_lib ${STARPU_SHM_libs_to_find})
-	    if(starpu_shm_lib STREQUAL starpu_lib)
-	      set(STARPU_SHM_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}")
-	    endif()
-	  endforeach()
-	  if (STARPU_LOOK_FOR_MPI AND MPI_FOUND)
-	    foreach(starpu_mpi_lib ${STARPU_MPI_libs_to_find})
-	      if(starpu_mpi_lib STREQUAL starpu_lib)
-		list(APPEND STARPU_MPI_LIBRARIES "${STARPU_${starpu_mpi_lib}_LIBRARY}")
-	      endif()
-	    endforeach()
-	  endif ()
-	endif()
+        if(NOT STARPU_FIND_QUIETLY)
+          message(STATUS "Looking for starpu -- lib ${starpu_lib} not found")
+        endif()
+        if(starpu_lib STREQUAL "starpumpi-${STARPU_VERSION}" AND
+            NOT STARPU_FIND_REQUIRED_MPI)
+          # if MPI optional, not a problem: no NOTFOUND in list of MPI LIBRARIES
+          if(NOT STARPU_FIND_QUIETLY)
+            message(STATUS "Looking for starpu -- lib ${starpu_lib} not required")
+          endif()
+        else()
+          # for any other lib, add NOTFOUND in the proper list of LIBRARIES
+          foreach(starpu_shm_lib ${STARPU_SHM_libs_to_find})
+            if(starpu_shm_lib STREQUAL starpu_lib)
+              set(STARPU_SHM_LIBRARIES "${STARPU_${starpu_lib}_LIBRARY}")
+            endif()
+          endforeach()
+          if (STARPU_LOOK_FOR_MPI AND MPI_FOUND)
+            foreach(starpu_mpi_lib ${STARPU_MPI_libs_to_find})
+              if(starpu_mpi_lib STREQUAL starpu_lib)
+                list(APPEND STARPU_MPI_LIBRARIES "${STARPU_${starpu_mpi_lib}_LIBRARY}")
+              endif()
+            endforeach()
+          endif ()
+        endif()
 
       endif (STARPU_${starpu_lib}_LIBRARY)
 
@@ -662,7 +671,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
     if (STARPU_SHM_LIBRARIES AND STARPU_LIBRARY_DIRS AND STARPU_INCLUDE_DIRS)
       set(STARPU_SHM_FOUND TRUE)
       if(STARPU_MPI_LIBRARIES)
-	set(STARPU_MPI_FOUND TRUE)
+        set(STARPU_MPI_FOUND TRUE)
       endif()
     endif()
 
@@ -704,142 +713,142 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
     set(CMAKE_REQUIRED_FLAGS)
     foreach(libdir ${STARPU_LIBRARY_DIRS})
       if (libdir)
-	list(APPEND REQUIRED_LIBDIRS "${libdir}")
+        list(APPEND REQUIRED_LIBDIRS "${libdir}")
       endif()
     endforeach()
     set(REQUIRED_LIBS "${STARPU_LIBRARIES}")
     # HWLOC
     if (HWLOC_FOUND AND STARPU_LOOK_FOR_HWLOC)
       if (HWLOC_INCLUDE_DIRS)
-	list(APPEND REQUIRED_INCDIRS "${HWLOC_INCLUDE_DIRS}")
+        list(APPEND REQUIRED_INCDIRS "${HWLOC_INCLUDE_DIRS}")
       endif()
       if (HWLOC_LIBRARY_DIRS)
-	list(APPEND REQUIRED_LIBDIRS "${HWLOC_LIBRARY_DIRS}")
+        list(APPEND REQUIRED_LIBDIRS "${HWLOC_LIBRARY_DIRS}")
       endif()
       foreach(lib ${HWLOC_LIBRARIES})
-	if (EXISTS ${lib} OR ${lib} MATCHES "^-")
-	  list(APPEND REQUIRED_LIBS "${lib}")
-	else()
-	  list(APPEND REQUIRED_LIBS "-l${lib}")
-	endif()
+        if (EXISTS ${lib} OR ${lib} MATCHES "^-")
+          list(APPEND REQUIRED_LIBS "${lib}")
+        else()
+          list(APPEND REQUIRED_LIBS "-l${lib}")
+        endif()
       endforeach()
     endif()
     # MPI
     if (MPI_FOUND AND STARPU_LOOK_FOR_MPI)
       if (MPI_C_INCLUDE_PATH)
-	list(APPEND REQUIRED_INCDIRS "${MPI_C_INCLUDE_PATH}")
+        list(APPEND REQUIRED_INCDIRS "${MPI_C_INCLUDE_PATH}")
       endif()
       if (MPI_C_LINK_FLAGS)
-	if (${MPI_C_LINK_FLAGS} MATCHES "  -")
-	  string(REGEX REPLACE " -" "-" MPI_C_LINK_FLAGS ${MPI_C_LINK_FLAGS})
-	endif()
-	list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}")
+        if (${MPI_C_LINK_FLAGS} MATCHES "  -")
+          string(REGEX REPLACE " -" "-" MPI_C_LINK_FLAGS ${MPI_C_LINK_FLAGS})
+        endif()
+        list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}")
       endif()
       list(APPEND REQUIRED_LIBS "${MPI_C_LIBRARIES}")
     endif()
     # MAGMA
     if (MAGMA_FOUND AND STARPU_LOOK_FOR_MAGMA)
       if (MAGMA_INCLUDE_DIRS_DEP)
-	list(APPEND REQUIRED_INCDIRS "${MAGMA_INCLUDE_DIRS_DEP}")
+        list(APPEND REQUIRED_INCDIRS "${MAGMA_INCLUDE_DIRS_DEP}")
       elseif(MAGMA_INCLUDE_DIRS)
-	list(APPEND REQUIRED_INCDIRS "${MAGMA_INCLUDE_DIRS}")
+        list(APPEND REQUIRED_INCDIRS "${MAGMA_INCLUDE_DIRS}")
       endif()
       if (MAGMA_LIBRARY_DIRS_DEP)
-	list(APPEND REQUIRED_LIBDIRS "${MAGMA_LIBRARY_DIRS_DEP}")
+        list(APPEND REQUIRED_LIBDIRS "${MAGMA_LIBRARY_DIRS_DEP}")
       elseif(MAGMA_LIBRARY_DIRS)
-	list(APPEND REQUIRED_LIBDIRS "${MAGMA_LIBRARY_DIRS}")
+        list(APPEND REQUIRED_LIBDIRS "${MAGMA_LIBRARY_DIRS}")
       endif()
       if (MAGMA_LIBRARIES_DEP)
-	list(APPEND REQUIRED_LIBS "${MAGMA_LIBRARIES_DEP}")
+        list(APPEND REQUIRED_LIBS "${MAGMA_LIBRARIES_DEP}")
       elseif(MAGMA_LIBRARIES)
-	foreach(lib ${MAGMA_LIBRARIES})
-	  if (EXISTS ${lib} OR ${lib} MATCHES "^-")
-	    list(APPEND REQUIRED_LIBS "${lib}")
-	  else()
-	    list(APPEND REQUIRED_LIBS "-l${lib}")
-	  endif()
-	endforeach()
+        foreach(lib ${MAGMA_LIBRARIES})
+          if (EXISTS ${lib} OR ${lib} MATCHES "^-")
+            list(APPEND REQUIRED_LIBS "${lib}")
+          else()
+            list(APPEND REQUIRED_LIBS "-l${lib}")
+          endif()
+        endforeach()
       endif()
       if (MAGMA_LINKER_FLAGS)
-	list(APPEND REQUIRED_LDFLAGS "${MAGMA_LINKER_FLAGS}")
+        list(APPEND REQUIRED_LDFLAGS "${MAGMA_LINKER_FLAGS}")
       endif()
     endif()
     # CUDA
     if (CUDA_FOUND AND STARPU_LOOK_FOR_CUDA)
       if (CUDA_INCLUDE_DIRS)
-	list(APPEND REQUIRED_INCDIRS "${CUDA_INCLUDE_DIRS}")
+        list(APPEND REQUIRED_INCDIRS "${CUDA_INCLUDE_DIRS}")
       endif()
       if (CUDA_LIBRARY_DIRS)
-	list(APPEND REQUIRED_LIBDIRS "${CUDA_LIBRARY_DIRS}")
+        list(APPEND REQUIRED_LIBDIRS "${CUDA_LIBRARY_DIRS}")
       endif()
       list(APPEND REQUIRED_LIBS "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}")
     endif()
     # FXT
     if (FXT_FOUND AND STARPU_LOOK_FOR_FXT)
       if (FXT_INCLUDE_DIRS)
-	list(APPEND REQUIRED_INCDIRS "${FXT_INCLUDE_DIRS}")
+        list(APPEND REQUIRED_INCDIRS "${FXT_INCLUDE_DIRS}")
       endif()
       if (FXT_LIBRARY_DIRS)
-	list(APPEND REQUIRED_LIBDIRS "${FXT_LIBRARY_DIRS}")
+        list(APPEND REQUIRED_LIBDIRS "${FXT_LIBRARY_DIRS}")
       endif()
       foreach(lib ${FXT_LIBRARIES})
-	if (EXISTS ${lib} OR ${lib} MATCHES "^-")
-	  list(APPEND REQUIRED_LIBS "${lib}")
-	else()
-	  list(APPEND REQUIRED_LIBS "-l${lib}")
-	endif()
+        if (EXISTS ${lib} OR ${lib} MATCHES "^-")
+          list(APPEND REQUIRED_LIBS "${lib}")
+        else()
+          list(APPEND REQUIRED_LIBS "-l${lib}")
+        endif()
       endforeach()
     endif()
     # SIMGRID
     if (SIMGRID_FOUND AND STARPU_LOOK_FOR_SIMGRID)
       if (SIMGRID_INCLUDE_DIRS)
-	list(APPEND REQUIRED_INCDIRS "${SIMGRID_INCLUDE_DIRS}")
+        list(APPEND REQUIRED_INCDIRS "${SIMGRID_INCLUDE_DIRS}")
       endif()
       if (SIMGRID_LIBRARY_DIRS)
-	list(APPEND REQUIRED_LIBDIRS "${SIMGRID_LIBRARY_DIRS}")
+        list(APPEND REQUIRED_LIBDIRS "${SIMGRID_LIBRARY_DIRS}")
       endif()
       foreach(lib ${SIMGRID_LIBRARIES})
-	if (EXISTS ${lib} OR ${lib} MATCHES "^-")
-	  list(APPEND REQUIRED_LIBS "${lib}")
-	else()
-	  list(APPEND REQUIRED_LIBS "-l${lib}")
-	endif()
+        if (EXISTS ${lib} OR ${lib} MATCHES "^-")
+          list(APPEND REQUIRED_LIBS "${lib}")
+        else()
+          list(APPEND REQUIRED_LIBS "-l${lib}")
+        endif()
       endforeach()
       list(APPEND REQUIRED_FLAGS "-include starpu_simgrid_wrap.h")
     endif()
     # BLAS
     if (BLAS_FOUND AND STARPU_LOOK_FOR_BLAS)
       if (BLAS_INCLUDE_DIRS)
-	list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}")
+        list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}")
       endif()
       if (BLAS_LIBRARY_DIRS)
-	list(APPEND REQUIRED_LIBDIRS "${BLAS_LIBRARY_DIRS}")
+        list(APPEND REQUIRED_LIBDIRS "${BLAS_LIBRARY_DIRS}")
       endif()
       list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}")
       if (BLAS_LINKER_FLAGS)
-	list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")
+        list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")
       endif()
     endif()
     # Fortran
     if (CMAKE_C_COMPILER_ID MATCHES "GNU")
       find_library(
-	FORTRAN_gfortran_LIBRARY
-	NAMES gfortran
-	HINTS ${_lib_env}
-	)
+        FORTRAN_gfortran_LIBRARY
+        NAMES gfortran
+        HINTS ${_lib_env}
+        )
       mark_as_advanced(FORTRAN_gfortran_LIBRARY)
       if (FORTRAN_gfortran_LIBRARY AND CMAKE_C_COMPILER_ID STREQUAL "GNU")
-	list(APPEND REQUIRED_LIBS "${FORTRAN_gfortran_LIBRARY}")
+        list(APPEND REQUIRED_LIBS "${FORTRAN_gfortran_LIBRARY}")
       endif()
     elseif (CMAKE_C_COMPILER_ID MATCHES "Intel")
       find_library(
-	FORTRAN_ifcore_LIBRARY
-	NAMES ifcore
-	HINTS ${_lib_env}
-	)
+        FORTRAN_ifcore_LIBRARY
+        NAMES ifcore
+        HINTS ${_lib_env}
+        )
       mark_as_advanced(FORTRAN_ifcore_LIBRARY)
       if (FORTRAN_ifcore_LIBRARY)
-	list(APPEND REQUIRED_LIBS "${FORTRAN_ifcore_LIBRARY}")
+        list(APPEND REQUIRED_LIBS "${FORTRAN_ifcore_LIBRARY}")
       endif()
     endif()
     # EXTRA LIBS such that pthread, m, rt
@@ -865,9 +874,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
     if(STARPU_WORKS)
       # save link with dependencies
       if (REQUIRED_FLAGS)
-	set(STARPU_LIBRARIES_DEP "${REQUIRED_FLAGS};${REQUIRED_LIBS}")
+        set(STARPU_LIBRARIES_DEP "${REQUIRED_FLAGS};${REQUIRED_LIBS}")
       else()
-	set(STARPU_LIBRARIES_DEP "${REQUIRED_LIBS}")
+        set(STARPU_LIBRARIES_DEP "${REQUIRED_LIBS}")
       endif()
       set(STARPU_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
       set(STARPU_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
@@ -877,13 +886,13 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
       list(REMOVE_DUPLICATES STARPU_LINKER_FLAGS)
     else()
       if(NOT STARPU_FIND_QUIETLY)
-	message(STATUS "Looking for starpu : test of starpu_init 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")
-	message(STATUS "Maybe STARPU is linked with specific libraries. "
-	  "Have you tried with COMPONENTS (HWLOC, CUDA, MPI, BLAS, MAGMA, FXT, SIMGRID)? "
-	  "See the explanation in FindSTARPU.cmake.")
+        message(STATUS "Looking for starpu : test of starpu_init 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")
+        message(STATUS "Maybe STARPU is linked with specific libraries. "
+          "Have you tried with COMPONENTS (HWLOC, CUDA, MPI, BLAS, MAGMA, FXT, SIMGRID)? "
+          "See the explanation in FindSTARPU.cmake.")
       endif()
     endif()
     set(CMAKE_REQUIRED_INCLUDES)
@@ -897,7 +906,7 @@ if (STARPU_LIBRARIES)
   if (STARPU_LIBRARY_DIRS)
     foreach(dir ${STARPU_LIBRARY_DIRS})
       if ("${dir}" MATCHES "starpu")
-	set(first_lib_path "${dir}")
+        set(first_lib_path "${dir}")
       endif()
     endforeach()
   else()
@@ -922,8 +931,8 @@ if(NOT STARPU_FIND_QUIETLY)
     message(STATUS "StarPU library has been found.")
     if(STARPU_MPI_LIBRARIES)
       message(STATUS "The mpi version of StarPU has been found so that we manage"
-	" two lists of libs, one sequential and one parallel (see"
-	" STARPU_SHM_LIBRARIES and STARPU_MPI_LIBRARIES).")
+        " two lists of libs, one sequential and one parallel (see"
+        " STARPU_SHM_LIBRARIES and STARPU_MPI_LIBRARIES).")
     endif()
     message(STATUS "StarPU shared memory libraries stored in STARPU_SHM_LIBRARIES")
   endif()
diff --git a/modules/find/FindSUITESPARSE.cmake b/modules/find/FindSUITESPARSE.cmake
index 6a017bfab7553a22a291c17ada62c34df9381a63..8aeb52d3bf6480d3e6556e6baf86e3563be46cb7 100644
--- a/modules/find/FindSUITESPARSE.cmake
+++ b/modules/find/FindSUITESPARSE.cmake
@@ -180,7 +180,7 @@ list(APPEND SUITESPARSE_hdrs_to_find
   "cs.h"
   "klu.h"
   "ldl.h"
-  "RBio.h"
+  #"RBio.h"
   "spqr.hpp"
   "SuiteSparse_config.h"
   "umfpack.h")
@@ -209,7 +209,7 @@ else()
       set(SUITESPARSE_${suitesparse_hdr}_DIRS "SUITESPARSE_${suitesparse_hdr}_INCLUDE_DIRS-NOTFOUND")
       find_path(SUITESPARSE_${suitesparse_hdr}_DIRS
 	NAMES ${suitesparse_hdr}
-	HINTS ${_inc_env})
+	HINTS ${_inc_env} ${_inc_env}/suitesparse)
       mark_as_advanced(SUITESPARSE_${suitesparse_hdr}_DIRS)
     endforeach()
   endif()
@@ -249,7 +249,7 @@ set(SUITESPARSE_libs_to_find
   "camd"
   "ccolamd"
   "colamd"
-  "rbio"
+  #"rbio"
   "suitesparseconfig"
   )
 
diff --git a/modules/find/RulesJDF.cmake b/modules/find/RulesJDF.cmake
index d3a7e5314041116159a196bad5f166fa9ec6e3c3..52d1679d5c2eaf1f4753f471719db299609203a1 100644
--- a/modules/find/RulesJDF.cmake
+++ b/modules/find/RulesJDF.cmake
@@ -3,6 +3,9 @@
 # Setup the minimal environment to compile and generate .JDF files.
 #
 
+set(PARSEC_PTGPP_CFLAGS "--noline" CACHE STRING "Additional parsec_ptgpp precompiling flags (separate flags with ';')" )
+mark_as_advanced(PARSEC_PTGPP_CFLAGS)
+
 #
 # This macro creates a rule for every jdf basename passed in SOURCES.
 # The OUTPUTLIST contains the list of files generated by the maxro.
diff --git a/modules/find/tests/CMakeLists.txt b/modules/find/tests/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..789aefec71cb7772febfd4fda72abef0b92129a2
--- /dev/null
+++ b/modules/find/tests/CMakeLists.txt
@@ -0,0 +1,112 @@
+cmake_minimum_required(VERSION 2.8)
+project(TEST_MORSE_CMAKE_MODULES_FIND Fortran C CXX)
+
+# location of find package modules
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../")
+
+# main variable: control the list of libraries to find thanks to find_package
+# pay attention that package names must be given with capital letters
+set(PACKAGES "" CACHE STRING "List of packages to find, ex: BLAS;STARPU;PASTIX")
+
+# specific components to look for with packages
+set(LAPACKE_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with LAPACKE, ex: TMG")
+set(QUARK_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with QUARK, ex: HWLOC")
+set(PASTIX_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with PASTIX, ex: MPI;SEQ;STARPU;STARPU_CUDA;STARPU_FXT;SCOTCH;PTSCOTCH;METIS")
+set(PETSC_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with PETSc, ex: CXX|C")
+set(FFTW_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with FFTW, ex: MKL;ESSL;THREADS;OMP;SIMPLE;LONG;QUAD")
+set(MUMPS_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with MUMPS, ex: MPI;SEQ;SCOTCH;PTSCOTCH;METIS;PARMETIS;OPENMP")
+set(CHAMELEON_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with CHAMELEON, ex: STARPU;QUARK;CUDA;MPI;FXT")
+set(STARPU_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with STARPU, ex: HWLOC;CUDA;MPI;BLAS;MAGMA;FXT;SIMGRID")
+set(PARSEC_COMPONENTS "" CACHE STRING "List of specific dependencies to look for with PARSEC, ex: HWLOC;CUDA;MPI;AYUDAME")
+
+# to enable ctests
+option(ENABLE_CTEST "Enable Testing: will test all supported packages" OFF)
+
+foreach(_library ${PACKAGES})
+
+  if (${_library}_COMPONENTS)
+    find_package(${_library} COMPONENTS ${${_library}_COMPONENTS})
+  else()
+    find_package(${_library})
+  endif()
+  if (${_library}_FOUND)
+    if (${_library}_LIBRARIES)
+      message(STATUS "${_library}_LIBRARIES found: ${${_library}_LIBRARIES}")
+    else()
+      message(WARNING "${_library}_LIBRARIES not found: ${${_library}_LIBRARIES}")
+    endif()
+    if (${_library}_LIBRARIES_DEP)
+      message(STATUS "${_library}_LIBRARIES_DEP found: ${${_library}_LIBRARIES_DEP}")
+    endif()
+    if (${_library}_LIBRARY_DIRS)
+      message(STATUS "${_library}_LIBRARY_DIRS found: ${${_library}_LIBRARY_DIRS}")
+    else()
+      message(WARNING "${_library}_LIBRARY_DIRS not found: ${${_library}_LIBRARY_DIRS}")
+    endif()
+    if (${_library}_LIBRARY_DIRS_DEP)
+      message(STATUS "${_library}_LIBRARY_DIRS_DEP found: ${${_library}_LIBRARY_DIRS_DEP}")
+    endif()
+    if (${_library}_INCLUDE_DIRS)
+      message(STATUS "${_library}_INCLUDE_DIRS found: ${${_library}_INCLUDE_DIRS}")
+    else()
+      message(WARNING "${_library}_INCLUDE_DIRS not found: ${${_library}_INCLUDE_DIRS}")
+    endif()
+    if (${_library}_INCLUDE_DIRS_DEP)
+      message(STATUS "${_library}_INCLUDE_DIRS_DEP found: ${${_library}_INCLUDE_DIRS_DEP}")
+    endif()
+  else()
+    message(FATAL_ERROR "${_library} NOT FOUND !!")
+  endif()
+
+endforeach()
+
+# Add CTest rules
+if (ENABLE_CTEST)
+
+  enable_testing()
+  include(CTest)
+
+  set(CTEST_PACKAGES_LIST
+      BLAS
+      BLASEXT
+      CBLAS
+      CHAMELEON
+      CPPCHECK
+      EZTRACE
+      #FABULOUS see https://gitlab.inria.fr/solverstack/fabulous/issues/1
+      FFTW
+      FXT
+      GTG
+      HQR
+      HWLOC
+      #HYPRE module not ready TODO: complete it
+      LAPACK
+      LAPACKE
+      LAPACKEXT
+      METIS
+      MPIEXT
+      MUMPS
+      #PAMPA not able to install it, link problem with ptscotch
+      PAPI
+      PARMETIS
+      PARSEC
+      PASTIX
+      PETSC
+      PTSCOTCH
+      QUARK
+      SCALAPACK
+      SCOTCH
+      SIMGRID
+      STARPU
+      SUITESPARSE
+      TMG)
+
+  foreach(_package ${CTEST_PACKAGES_LIST})
+    add_test(FIND${_package} cmake ${CMAKE_SOURCE_DIR} -DPACKAGES=${_package})
+  endforeach()
+
+endif()
+
+###
+### END CMakeLists.txt
+###
diff --git a/modules/find/tests/README.md b/modules/find/tests/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..aca2ca614ee4e5f22d428f001f5dba3aa9c8174b
--- /dev/null
+++ b/modules/find/tests/README.md
@@ -0,0 +1,17 @@
+Test MORSE CMake modules
+========================
+
+Procedure to test the `find_package` modules hosted in `modules/find`
+
+```
+git clone https://gitlab.inria.fr/solverstack/morse_cmake.git
+cd morse_cmake/modules/find/tests
+mkdir build
+cd build
+# to test all the packages, e.g.
+cmake .. -DENABLE_CTEST=ON
+# to test some only, e.g.
+cmake .. -DPACKAGES="HWLOC;STARPU;PASTIX"
+# to enable some components in some find, e.g. here we look for QUARK linked with HWLOC and PASTIX with PARSEC and STARPU
+cmake .. -DENABLE_CTEST=ON -DQUARK_COMPONENTS="HWLOC" -DPASTIX_COMPONENTS="PARSEC;STARPU"
+```
diff --git a/modules/precision_generator/subs.py b/modules/precision_generator/subs.py
index cf8c4be4326ba77c464384fe9b26d698504ee9dc..1d093729e378a1d7eb450362013a29e9e873e2d2 100644
--- a/modules/precision_generator/subs.py
+++ b/modules/precision_generator/subs.py
@@ -82,6 +82,8 @@ subs = {
     ('morse_get_s',               'morse_get_c'                      ),
     ('TASK_S',                    'TASK_C'                           ),
     ('TASK_D',                    'TASK_Z'                           ),
+    ('TASKS_S',                   'TASKS_C'                          ),
+    ('TASKS_D',                   'TASKS_Z'                          ),
     ('RUNTIME_S',                 'RUNTIME_C'                        ),
     ('RUNTIME_D',                 'RUNTIME_Z'                        ),
 
@@ -280,6 +282,7 @@ subs = {
     ('', 'real',                 'real',                  'complex',                         r'\bcomplex'                          ),
     ('', 'float',                'double',                'float2',                          r'\bdouble2'                          ),
     ('', 'float',                'double',                'float',                           r'\bdouble'                           ),
+    ('', 'float',                'double',                'complex',                          'double_complex'                     ),
 
     # ----- Text
     ('Symmetric', 'Symmetric',      'Symmetric',      'Hermitian',      'Hermitian'       ),
@@ -382,6 +385,8 @@ subs = {
     ('', 'TASK_stsmqr_sy', 'TASK_dtsmqr_sy', 'TASK_ctsmqr_he', 'TASK_ztsmqr_he'  ),
     ('', 'TASK_sor',       'TASK_dor',       'TASK_cun',       'TASK_zun'        ),
     ('', 'TASK_s',         'TASK_d',         'TASK_c',         'TASK_z'          ),
+    ('', 'TASKS_s',        'TASKS_d',        'TASKS_c',        'TASKS_z'         ),
+    ('', 'tasks_s',        'tasks_d',        'tasks_c',        'tasks_z'         ),
     ('', 'TASK_slan',      'TASK_dlan',      'TASK_slan',      'TASK_dlan'       ),
     ('', 'RUNTIME_S',      'RUNTIME_D',      'RUNTIME_C',      'RUNTIME_Z'       ),
     ('', 'RUNTIME_s',      'RUNTIME_d',      'RUNTIME_c',      'RUNTIME_z'       ),
@@ -395,6 +400,7 @@ subs = {
     ('', 'csc_s',          'csc_d',          'csc_c',          'csc_z'           ),
     ('', 'sequential_s',   'sequential_d',   'sequential_c',   'sequential_z'    ),
     ('', 'coeftab_s',      'coeftab_d',      'coeftab_c',      'coeftab_z'       ),
+    ('', 'cblk_s',         'cblk_d',         'cblk_c',         'cblk_z'          ),
     ('', 'thread_s',       'thread_d',       'thread_c',       'thread_z'        ),
     ('', 'thread_ps',      'thread_pd',      'thread_pc',      'thread_pz'       ),
 
@@ -565,6 +571,7 @@ subs = {
     ('', 'ssysv',          'dsysv',          'csysv',          'zsysv'           ),
     ('', 'sposv',          'sposv',          'cposv',          'cposv'           ),
     ('', 'spotrf',         'dpotrf',         'cpotrf',         'zpotrf'          ),
+    ('', 'spotrf',         'dpotrf',         'cpxtrf',         'zpxtrf'          ),
     ('', 'ssytrf',         'dsytrf',         'csytrf',         'zsytrf'          ),
     ('', 'spotri',         'dpotri',         'cpotri',         'zpotri'          ),
     ('', 'spotrs',         'dpotrs',         'cpotrs',         'zpotrs'          ),
@@ -621,6 +628,7 @@ subs = {
     ('', 'sger',           'dger',           'cgerc',          'zgerc'           ),
     ('', 'sger',           'dger',           'cgeru',          'zgeru'           ),
     ('', 'snrm2',          'dnrm2',          'scnrm2',         'dznrm2'          ),
+    ('', 'snrm2',          'dnrm2',          'snrm2',          'dnrm2'           ),
     ('', 'ssymm',          'dsymm',          'chemm',          'zhemm'           ),
     ('', 'ssymv',          'dsymv',          'chemv',          'zhemv'           ),
     ('', 'ssyr2',          'dsyr2',          'cher2',          'zher2'           ),
@@ -836,6 +844,7 @@ subs = {
     ('', 'SSYSV',          'DSYSV',          'CSYSV',          'ZSYSV'           ),
     ('', 'SPOSV',          'SPOSV',          'CPOSV',          'CPOSV'           ),
     ('', 'SPOTRF',         'DPOTRF',         'CPOTRF',         'ZPOTRF'          ),
+    ('', 'SPOTRF',         'DPOTRF',         'CPXTRF',         'ZPXTRF'          ),
     ('', 'SSYTRF',         'DSYTRF',         'CSYTRF',         'ZSYTRF'          ),
     ('', 'SPOTRI',         'DPOTRI',         'CPOTRI',         'ZPOTRI'          ),
     ('', 'SPOTRS',         'DPOTRS',         'CPOTRS',         'ZPOTRS'          ),