diff --git a/CMakeLists.txt b/CMakeLists.txt
index 50c79340fb8e08b7bac35864f4961eff6311bcc8..9852ac6c00fc6e647549ad5171bed21b889d14a9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -306,6 +306,9 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/")
                 # the RPATH to be used when installing
                 list(APPEND CMAKE_INSTALL_RPATH "${CBLAS_LIBRARY_DIRS}")
             endif()
+            if(CBLAS_LINKER_FLAGS)
+                list(APPEND CMAKE_EXE_LINKER_FLAGS "${CBLAS_LINKER_FLAGS}")
+            endif()
         else()
             if(MORSE_VERBOSE_FIND_PACKAGE)
                 if(CBLAS_STANDALONE OR NOT CBLAS_WORKS)
@@ -342,6 +345,9 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/")
                 # the RPATH to be used when installing
                 list(APPEND CMAKE_INSTALL_RPATH "${LAPACKE_LIBRARY_DIRS}")
             endif()
+            if(LAPACKE_LINKER_FLAGS)
+                list(APPEND CMAKE_EXE_LINKER_FLAGS "${LAPACKE_LINKER_FLAGS}")
+            endif()
         else()
             if(MORSE_VERBOSE_FIND_PACKAGE)
                 if (LAPACKE_STANDALONE OR NOT LAPACKE_WORKS)
@@ -369,6 +375,9 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/")
             else()
                 message(FATAL_ERROR "A TMG library is required but has not been found")
             endif()
+            if(TMG_LINKER_FLAGS)
+                list(APPEND CMAKE_EXE_LINKER_FLAGS "${TMG_LINKER_FLAGS}")
+            endif()
         endif()
 
         # CHAMELEON depends on CUDA/CUBLAS
@@ -464,6 +473,9 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/")
                 # tests for intel mpi
                 #list(APPEND MPI_C_COMPILE_FLAGS "-mt_mpi")
                 #list(APPEND MPI_COMPILE_FLAGS "-mt_mpi")
+                if(MPI_C_LINK_FLAGS)
+                    list(APPEND CMAKE_EXE_LINKER_FLAGS "${MPI_C_LINK_FLAGS}")
+                endif()
             endif (MPI_C_FOUND)
 
         endif (CHAMELEON_USE_MPI)
@@ -541,6 +553,9 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/")
             " - Activate StarPU in Chameleon${ColourReset}")
             add_definitions(-DCHAMELEON_SCHED_STARPU) # TODO: remove that
             include_directories(${STARPU_INCLUDE_DIRS})
+            if(STARPU_LINKER_FLAGS)
+                list(APPEND CMAKE_EXE_LINKER_FLAGS "${STARPU_LINKER_FLAGS}")
+            endif()
             set(CMAKE_REQUIRED_INCLUDES "${STARPU_INCLUDE_DIRS}")
             foreach(libdir ${STARPU_LIBRARY_DIRS})
                 list(APPEND CMAKE_REQUIRED_FLAGS "-L${libdir}")
@@ -684,6 +699,9 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/")
 
     endif()
 
+    list(REMOVE_DUPLICATES CMAKE_EXE_LINKER_FLAGS)
+    string(REPLACE ";" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
+
     # Add define for Fortran Mangling (should be defined somewhere else)
     # ------------------------------------------------------------------
     message("-- ${Blue}Add definition ADD_"
@@ -808,7 +826,7 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/")
     string(REGEX MATCH ".*ifort$" _match_ifort ${CMAKE_Fortran_COMPILER})
     if(_match_ifort)
         #message(STATUS "Add -nofor_main to the Fortran linker")
-        set(CMAKE_Fortran_FLAGS "-nofor_main")
+        list(APPEND CMAKE_Fortran_FLAGS "-nofor_main")
     endif(_match_ifort)
 
     # Testing executables
diff --git a/cmake_modules/morse/find/FindBLAS.cmake b/cmake_modules/morse/find/FindBLAS.cmake
index 8c946b77b92f1d0adb3e02ea75108f7f0302bcec..d2b71bcff70eefd571361dc6dafa58823474e850 100644
--- a/cmake_modules/morse/find/FindBLAS.cmake
+++ b/cmake_modules/morse/find/FindBLAS.cmake
@@ -110,7 +110,7 @@ macro(Print_Find_Library_Blas_Status _libname _lib_to_find)
         endif()
     endif()
     message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n"
-            "- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n"
+            "- Option 1: Provide the Installation directory of BLAS library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n"
             "- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n"
             "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
             "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}")
@@ -135,14 +135,13 @@ macro(Print_Find_Library_Blas_CheckFunc_Status _name)
 endmacro()
 
 if (NOT BLAS_FOUND)
-    set(BLAS_DIR "" CACHE PATH "Root directory of BLAS library")
+    set(BLAS_DIR "" CACHE PATH "Installation directory of BLAS library")
     if (NOT BLAS_FIND_QUIETLY)
         message(STATUS "A cache variable, namely BLAS_DIR, has been set to specify the install directory of BLAS")
     endif()
 endif()
 
-option(BLAS_VERBOSE "Print some additional information during BLAS
-libraries detection" OFF)
+option(BLAS_VERBOSE "Print some additional information during BLAS libraries detection" OFF)
 
 include(CheckFunctionExists)
 include(CheckFortranFunctionExists)
@@ -179,7 +178,7 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
     set(_libdir ${ARGN})
 
     set(_libraries_work TRUE)
-    set(${LIBRARIES} ${_flags})
+    set(${LIBRARIES})
     set(_combined_name)
     if (NOT _libdir)
         if (BLAS_DIR)
@@ -192,20 +191,20 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
                 list(APPEND _libdir "${BLAS_DIR}/lib32")
                 list(APPEND _libdir "${BLAS_DIR}/lib/ia32")
             endif()
-        endif ()
-        if (BLAS_LIBDIR)
+        elseif (BLAS_LIBDIR)
             list(APPEND _libdir "${BLAS_LIBDIR}")
-        endif ()
-        if (WIN32)
-            string(REPLACE ":" ";" _libdir2 "$ENV{LIB}")
-        elseif (APPLE)
-            string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}")
-        else ()
-            string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}")
-        endif ()
-        list(APPEND _libdir "${_libdir2}")
-        list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
-        list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
+        else()
+            if (WIN32)
+                string(REPLACE ":" ";" _libdir2 "$ENV{LIB}")
+            elseif (APPLE)
+                string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}")
+            else ()
+                string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}")
+            endif ()
+            list(APPEND _libdir "${_libdir2}")
+            list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
+            list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
+        endif()
     endif ()
 
     if (BLAS_VERBOSE)
@@ -272,10 +271,10 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
     endif()
 
     if(_libraries_work)
-        set(${LIBRARIES} ${${LIBRARIES}} ${_thread})
-    else()
+      set(${LIBRARIES} ${${LIBRARIES}} ${_thread})
+    else(_libraries_work)
         set(${LIBRARIES} FALSE)
-    endif()
+    endif(_libraries_work)
 
 # message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
 
@@ -476,6 +475,9 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
                 "${SEARCH_LIBS}"
                 "${CMAKE_THREAD_LIBS_INIT};${LM}"
                 )
+                if(_LIBRARIES)
+                    set(BLAS_LINKER_FLAGS "${additional_flags}")
+                endif()
             endif()
         endforeach ()
 
@@ -870,7 +872,7 @@ if(BLA_F95)
         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 root directory of BLAS library with cmake option: -DBLAS_DIR=your/path/to/blas\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."
@@ -890,6 +892,9 @@ if(BLA_F95)
 
     set(BLAS_FOUND TRUE)
     set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
+    if (NOT BLAS_LIBRARIES_DEP)
+        set(BLAS_LIBRARIES_DEP "${BLAS95_LIBRARIES}")
+    endif()
 
 else(BLA_F95)
 
@@ -906,7 +911,7 @@ else(BLA_F95)
         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 root directory of BLAS library with cmake option: -DBLAS_DIR=your/path/to/blas\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."
@@ -927,3 +932,13 @@ else(BLA_F95)
 endif(BLA_F95)
 
 set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+
+if (BLAS_FOUND AND NOT BLAS_DIR)
+    list(GET BLAS_LIBRARIES 0 first_lib)
+    get_filename_component(first_lib_path "${first_lib}" PATH)
+    if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)")
+        string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}")
+        set(BLAS_DIR "${not_cached_dir}" CACHE PATH "Installation directory of BLAS library" FORCE)
+    endif()
+endif()
+
diff --git a/cmake_modules/morse/find/FindCBLAS.cmake b/cmake_modules/morse/find/FindCBLAS.cmake
index bbf09d2767e67af478436363059d1d4c9441eddb..f75ed4b0ca4c180390ad040ef799ada6c4dba6a5 100644
--- a/cmake_modules/morse/find/FindCBLAS.cmake
+++ b/cmake_modules/morse/find/FindCBLAS.cmake
@@ -26,6 +26,7 @@
 # This module finds headers and cblas library.
 # Results are reported in variables:
 #  CBLAS_FOUND            - True if headers and requested libraries were found
+#  CBLAS_LINKER_FLAGS     - list of required linker flags (excluding -l and -L)
 #  CBLAS_INCLUDE_DIRS     - cblas include directories
 #  CBLAS_LIBRARY_DIRS     - Link directories for cblas libraries
 #  CBLAS_LIBRARIES        - cblas component libraries to be linked
@@ -65,7 +66,7 @@
 
 
 if (NOT CBLAS_FOUND)
-    set(CBLAS_DIR "" CACHE PATH "Root directory of CBLAS library")
+    set(CBLAS_DIR "" CACHE PATH "Installation directory of CBLAS library")
     if (NOT CBLAS_FIND_QUIETLY)
         message(STATUS "A cache variable, namely CBLAS_DIR, has been set to specify the install directory of CBLAS")
     endif()
@@ -107,7 +108,7 @@ if (BLAS_FOUND)
         # check if a cblas function exists in the BLAS lib
         # this can be the case with libs such as MKL, ACML
         include(CheckFunctionExists)
-        set(CMAKE_REQUIRED_LIBRARIES "${BLAS_LIBRARIES}")
+        set(CMAKE_REQUIRED_LIBRARIES "${BLAS_LINKER_FLAGS};${BLAS_LIBRARIES}")
         unset(CBLAS_WORKS CACHE)
         check_function_exists(cblas_dscal CBLAS_WORKS)
         mark_as_advanced(CBLAS_WORKS)
@@ -119,10 +120,15 @@ if (BLAS_FOUND)
             endif()
             # test succeeds: CBLAS is in BLAS
             set(CBLAS_LIBRARIES "${BLAS_LIBRARIES}")
-            set(CBLAS_LIBRARY_DIRS "${BLAS_LIBRARY_DIRS}")
+            if (BLAS_LIBRARY_DIRS)
+                set(CBLAS_LIBRARY_DIRS "${BLAS_LIBRARY_DIRS}")
+            endif()
             if(BLAS_INCLUDE_DIRS)
                 set(CBLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIRS}")
             endif()
+            if (BLAS_LINKER_FLAGS)
+                set(CBLAS_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
+            endif()
         endif()
     endif (NOT CBLAS_STANDALONE)
 
@@ -258,6 +264,7 @@ if (BLAS_FOUND)
         if(CBLAS_LIBRARIES)
 
             set(REQUIRED_INCDIRS)
+            set(REQUIRED_LDFLAGS)
             set(REQUIRED_LIBDIRS)
             set(REQUIRED_LIBS)
 
@@ -277,10 +284,14 @@ if (BLAS_FOUND)
                 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}")
+            endif()
 
             # set required libraries for link
             set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
             set(CMAKE_REQUIRED_LIBRARIES)
+            list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
             foreach(lib_dir ${REQUIRED_LIBDIRS})
                 list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
             endforeach()
@@ -297,8 +308,10 @@ if (BLAS_FOUND)
                 set(CBLAS_LIBRARIES_DEP "${REQUIRED_LIBS}")
                 set(CBLAS_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
                 set(CBLAS_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
+                set(CBLAS_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
                 list(REMOVE_DUPLICATES CBLAS_LIBRARY_DIRS_DEP)
                 list(REMOVE_DUPLICATES CBLAS_INCLUDE_DIRS_DEP)
+                list(REMOVE_DUPLICATES CBLAS_LINKER_FLAGS)
             else()
                 if(NOT CBLAS_FIND_QUIETLY)
                     message(STATUS "Looking for cblas : test of cblas_dscal with cblas and blas libraries fails")
@@ -323,6 +336,14 @@ else(BLAS_FOUND)
 
 endif(BLAS_FOUND)
 
+if (CBLAS_LIBRARIES AND NOT CBLAS_DIR)
+    list(GET CBLAS_LIBRARIES 0 first_lib)
+    get_filename_component(first_lib_path "${first_lib}" PATH)
+    if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)")
+        string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}")
+        set(CBLAS_DIR "${not_cached_dir}" CACHE PATH "Installation directory of CBLAS library" FORCE)
+    endif()
+endif()
 
 # check that CBLAS has been found
 # -------------------------------
diff --git a/cmake_modules/morse/find/FindCHAMELEON.cmake b/cmake_modules/morse/find/FindCHAMELEON.cmake
index 815452956c2986792da3001c478d25a251bea03c..6adec0fa025cab9d5001f57fb70e27051c94bb48 100644
--- a/cmake_modules/morse/find/FindCHAMELEON.cmake
+++ b/cmake_modules/morse/find/FindCHAMELEON.cmake
@@ -37,6 +37,7 @@
 # This module finds headers and chameleon library.
 # Results are reported in variables:
 #  CHAMELEON_FOUND            - True if headers and requested libraries were found
+#  CHAMELEON_LINKER_FLAGS     - list of required linker flags (excluding -l and -L)
 #  CHAMELEON_INCLUDE_DIRS     - chameleon include directories
 #  CHAMELEON_LIBRARY_DIRS     - Link directories for chameleon libraries
 #  CHAMELEON_INCLUDE_DIRS_DEP - chameleon + dependencies include directories
@@ -67,7 +68,7 @@
 
 
 if (NOT CHAMELEON_FOUND)
-    set(CHAMELEON_DIR "" CACHE PATH "Root directory of CHAMELEON library")
+    set(CHAMELEON_DIR "" CACHE PATH "Installation directory of CHAMELEON library")
     if (NOT CHAMELEON_FIND_QUIETLY)
         message(STATUS "A cache variable, namely CHAMELEON_DIR, has been set to specify the install directory of CHAMELEON")
     endif()
@@ -116,7 +117,7 @@ endif()
 # -------------------------------------------------------------------------------------
 include(FindPkgConfig)
 find_package(PkgConfig QUIET)
-if(PKG_CONFIG_EXECUTABLE)
+if(PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_DIR)
 
     pkg_search_module(CHAMELEON chameleon)
     if (NOT CHAMELEON_FIND_QUIETLY)
@@ -155,7 +156,7 @@ if(PKG_CONFIG_EXECUTABLE)
         endif()
     endif()
 
-endif(PKG_CONFIG_EXECUTABLE)
+endif()
 
 if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
 
@@ -499,10 +500,10 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
     # check a function to validate the find
     if(CHAMELEON_LIBRARIES)
 
+        set(REQUIRED_LDFLAGS)
         set(REQUIRED_INCDIRS)
         set(REQUIRED_LIBDIRS)
         set(REQUIRED_LIBS)
-        set(REQUIRED_FLAGS)
 
         # CHAMELEON
         if (CHAMELEON_INCLUDE_DIRS)
@@ -598,7 +599,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
                 list(APPEND REQUIRED_INCDIRS "${MPI_C_INCLUDE_PATH}")
             endif()
             if (MPI_C_LINK_FLAGS)
-                list(APPEND REQUIRED_FLAGS "${MPI_C_LINK_FLAGS}")
+                list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}")
             endif()
             list(APPEND REQUIRED_LIBS "${MPI_C_LIBRARIES}")
         endif()
@@ -637,6 +638,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
             elseif(TMG_LIBRARIES)
                 list(APPEND REQUIRED_LIBS "${TMG_LIBRARIES}")
             endif()
+            if (TMG_LINKER_FLAGS)
+                list(APPEND REQUIRED_LDFLAGS "${TMG_LINKER_FLAGS}")
+            endif()
         endif()
         # LAPACKE
         if (LAPACKE_FOUND)
@@ -655,6 +659,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
             elseif(LAPACKE_LIBRARIES)
                 list(APPEND REQUIRED_LIBS "${LAPACKE_LIBRARIES}")
             endif()
+            if (LAPACK_LINKER_FLAGS)
+                list(APPEND REQUIRED_LDFLAGS "${LAPACK_LINKER_FLAGS}")
+            endif()
         endif()
         # CBLAS
         if (CBLAS_FOUND)
@@ -673,6 +680,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
             elseif(CBLAS_LIBRARIES)
                 list(APPEND REQUIRED_LIBS "${CBLAS_LIBRARIES}")
             endif()
+            if (BLAS_LINKER_FLAGS)
+                list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")
+            endif()
         endif()
         # EXTRA LIBS such that pthread, m, rt
         list(APPEND REQUIRED_LIBS ${CHAMELEON_EXTRA_LIBRARIES})
@@ -680,11 +690,11 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
         # set required libraries for link
         set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
         set(CMAKE_REQUIRED_LIBRARIES)
+        list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
         foreach(lib_dir ${REQUIRED_LIBDIRS})
             list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
         endforeach()
         list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
-        list(APPEND CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
 
         # test link
         unset(CHAMELEON_WORKS CACHE)
@@ -694,15 +704,13 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
 
         if(CHAMELEON_WORKS)
             # save link with dependencies
-            if (REQUIRED_FLAGS)
-                set(CHAMELEON_LIBRARIES_DEP "${REQUIRED_FLAGS};${REQUIRED_LIBS}")
-            else()
-                set(CHAMELEON_LIBRARIES_DEP "${REQUIRED_LIBS}")
-            endif()
+            set(CHAMELEON_LIBRARIES_DEP "${REQUIRED_LIBS}")
             set(CHAMELEON_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
             set(CHAMELEON_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
+            set(CHAMELEON_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
             list(REMOVE_DUPLICATES CHAMELEON_LIBRARY_DIRS_DEP)
             list(REMOVE_DUPLICATES CHAMELEON_INCLUDE_DIRS_DEP)
+            list(REMOVE_DUPLICATES CHAMELEON_LINKER_FLAGS)
         else()
             if(NOT CHAMELEON_FIND_QUIETLY)
                 message(STATUS "Looking for chameleon : test of MORSE_Init fails")
@@ -721,6 +729,22 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
 
 endif( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
 
+if (CHAMELEON_LIBRARIES AND NOT CHAMELEON_DIR)
+    if (CHAMELEON_LIBRARY_DIRS)
+        foreach(dir ${CHAMELEON_LIBRARY_DIRS})
+            if ("${dir}" MATCHES "chameleon")
+                set(first_lib_path "${dir}")
+            endif()
+        endforeach()
+    else()
+        list(GET CHAMELEON_LIBRARIES 0 first_lib)
+        get_filename_component(first_lib_path "${first_lib}" PATH)
+    endif()
+    if (${first_lib_path} MATCHES "/lib(32|64)?$")
+        string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
+        set(CHAMELEON_DIR "${not_cached_dir}" CACHE PATH "Installation directory of CHAMELEON library" FORCE)
+    endif()
+endif()
 
 # check that CHAMELEON has been found
 # ---------------------------------
diff --git a/cmake_modules/morse/find/FindFFTW.cmake b/cmake_modules/morse/find/FindFFTW.cmake
index 0d7622c9a33a5f5d23eb55aa0dca26a02bd3bc55..57b361b725f7960cab43354d5f7fab02b4fdc5e4 100644
--- a/cmake_modules/morse/find/FindFFTW.cmake
+++ b/cmake_modules/morse/find/FindFFTW.cmake
@@ -26,6 +26,8 @@
 # This module finds headers and fftw library.
 # Results are reported in variables:
 #  FFTW_FOUND            - True if headers and requested libraries were found
+#  FFTW_C_FLAGS          - list of required compilation flags (excluding -I)
+#  FFTW_LINKER_FLAGS     - list of required linker flags (excluding -l and -L)
 #  FFTW_INCLUDE_DIRS     - fftw include directories
 #  FFTW_LIBRARY_DIRS     - Link directories for fftw libraries
 #  FFTW_LIBRARIES        - fftw component libraries to be linked
@@ -58,7 +60,7 @@
 
 
 if (NOT FFTW_FOUND)
-    set(FFTW_DIR "" CACHE PATH "Root directory of FFTW library")
+    set(FFTW_DIR "" CACHE PATH "Installation directory of FFTW library")
     if (NOT FFTW_FIND_QUIETLY)
         message(STATUS "A cache variable, namely FFTW_DIR, has been set to specify the install directory of FFTW")
     endif()
@@ -344,6 +346,8 @@ if( NOT FFTW_FOUND )
     # check a function to validate the find
     if(FFTW_LIBRARIES)
 
+        set(REQUIRED_FLAGS)
+        set(REQUIRED_LDFLAGS)
         set(REQUIRED_INCDIRS)
         set(REQUIRED_LIBDIRS)
         set(REQUIRED_LIBS)
@@ -363,21 +367,24 @@ if( NOT FFTW_FOUND )
         # OMP
         if(FFTW_LOOK_FOR_OMP)
             if (CMAKE_C_COMPILER MATCHES ".+gcc.*")
-                set(CMAKE_REQUIRED_FLAGS "-fopenmp")
+                set(REQUIRED_FLAGS "-fopenmp")
             endif()
         endif()
         # MKL
         if(FFTW_LOOK_FOR_MKL)
-            list(APPEND REQUIRED_LIBS "-Wl,--no-as-needed;${CMAKE_REQUIRED_LIBRARIES};${CMAKE_THREAD_LIBS_INIT};-lm")
+            list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT};-lm")
+            list(APPEND REQUIRED_LDFLAGS "-Wl,--no-as-needed")
         endif()
 
         # set required libraries for link
         set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
         set(CMAKE_REQUIRED_LIBRARIES)
+        list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
         foreach(lib_dir ${REQUIRED_LIBDIRS})
             list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
         endforeach()
         list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
+        list(APPEND CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
 
         # test link
         unset(FFTW_WORKS CACHE)
@@ -390,13 +397,17 @@ if( NOT FFTW_FOUND )
             set(FFTW_LIBRARIES_DEP "${REQUIRED_LIBS}")
             set(FFTW_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
             set(FFTW_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
+            set(FFTW_C_FLAGS "${REQUIRED_FLAGS}")
+            set(FFTW_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
             list(REMOVE_DUPLICATES FFTW_LIBRARY_DIRS_DEP)
             list(REMOVE_DUPLICATES FFTW_INCLUDE_DIRS_DEP)
+            list(REMOVE_DUPLICATES FFTW_LINKER_FLAGS)
         else()
             if(NOT FFTW_FIND_QUIETLY)
                 message(STATUS "Looking for FFTW : test of ${FFTW_PREC_TESTFUNC}fftw_execute_ with fftw library fails")
                 message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
                 message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
+                message(STATUS "CMAKE_REQUIRED_FLAGS: ${CMAKE_REQUIRED_FLAGS}")
                 message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
             endif()
         else()
@@ -409,6 +420,14 @@ if( NOT FFTW_FOUND )
 
 endif( NOT FFTW_FOUND )
 
+if (FFTW_LIBRARIES AND NOT FFTW_DIR)
+    list(GET FFTW_LIBRARIES 0 first_lib)
+    get_filename_component(first_lib_path "${first_lib}" PATH)
+    if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)")
+        string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}")
+        set(FFTW_DIR "${not_cached_dir}" CACHE PATH "Installation directory of FFTW library" FORCE)
+    endif()
+endif()
 
 # check that FFTW has been found
 # -------------------------------
diff --git a/cmake_modules/morse/find/FindFXT.cmake b/cmake_modules/morse/find/FindFXT.cmake
index fdc1490761180c04abc95c2ac436f3f2cdf6efc1..ee8bbb942b8f4d6f5aba23cb26b4631a192c9f62 100644
--- a/cmake_modules/morse/find/FindFXT.cmake
+++ b/cmake_modules/morse/find/FindFXT.cmake
@@ -44,7 +44,7 @@
 #  License text for the above reference.)
 
 if (NOT FXT_FOUND)
-    set(FXT_DIR "" CACHE PATH "Root directory of FXT library")
+    set(FXT_DIR "" CACHE PATH "Installation directory of FXT library")
     if (NOT FXT_FIND_QUIETLY)
         message(STATUS "A cache variable, namely FXT_DIR, has been set to specify the install directory of FXT")
     endif()
@@ -54,7 +54,7 @@ endif()
 # -------------------------------------------------------------------------------------
 include(FindPkgConfig)
 find_package(PkgConfig QUIET)
-if(PKG_CONFIG_EXECUTABLE)
+if(PKG_CONFIG_EXECUTABLE AND NOT FXT_DIR)
 
     pkg_search_module(FXT fxt)
     if (NOT FXT_FIND_QUIETLY)
@@ -72,7 +72,7 @@ if(PKG_CONFIG_EXECUTABLE)
         endif()
     endif()
 
-endif(PKG_CONFIG_EXECUTABLE)
+endif()
 
 if( (NOT PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR NOT FXT_FOUND )
 
@@ -250,6 +250,18 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR NOT FXT_FOUND )
 
 endif( (NOT PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR NOT FXT_FOUND )
 
+if (FXT_LIBRARIES AND NOT FXT_DIR)
+    if (FXT_LIBRARY_DIRS)
+        list(GET FXT_LIBRARY_DIRS 0 first_lib_path)
+    else()
+        list(GET FXT_LIBRARIES 0 first_lib)
+        get_filename_component(first_lib_path "${first_lib}" PATH)
+    endif()
+    if (${first_lib_path} MATCHES "/lib(32|64)?$")
+        string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
+        set(FXT_DIR "${not_cached_dir}" CACHE PATH "Installation directory of FXT library" FORCE)
+    endif()
+endif()
 
 # check that FXT has been found
 # -------------------------------
diff --git a/cmake_modules/morse/find/FindHWLOC.cmake b/cmake_modules/morse/find/FindHWLOC.cmake
index ee08a29cf004c124db0e4b0e51ce87e6bccba8cf..8157c381f2d69ffd49b3d8d56525aa1d6b1e4875 100644
--- a/cmake_modules/morse/find/FindHWLOC.cmake
+++ b/cmake_modules/morse/find/FindHWLOC.cmake
@@ -45,7 +45,7 @@
 
 
 if (NOT HWLOC_FOUND)
-    set(HWLOC_DIR "" CACHE PATH "Root directory of HWLOC library")
+    set(HWLOC_DIR "" CACHE PATH "Installation directory of HWLOC library")
     if (NOT HWLOC_FIND_QUIETLY)
         message(STATUS "A cache variable, namely HWLOC_DIR, has been set to specify the install directory of HWLOC")
     endif()
@@ -55,7 +55,7 @@ endif()
 # -------------------------------------------------------------------------------------
 include(FindPkgConfig)
 find_package(PkgConfig QUIET)
-if(PKG_CONFIG_EXECUTABLE)
+if(PKG_CONFIG_EXECUTABLE AND NOT HWLOC_DIR)
 
     pkg_search_module(HWLOC hwloc)
     if (NOT HWLOC_FIND_QUIETLY)
@@ -73,7 +73,7 @@ if(PKG_CONFIG_EXECUTABLE)
         endif()
     endif()
 
-endif(PKG_CONFIG_EXECUTABLE)
+endif()
 
 if( (NOT PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) OR NOT HWLOC_FOUND )
 
@@ -257,6 +257,18 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) OR NOT HWLOC_FOUND )
 
 endif( (NOT PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) OR NOT HWLOC_FOUND )
 
+if (HWLOC_LIBRARIES AND NOT HWLOC_DIR)
+    if (HWLOC_LIBRARY_DIRS)
+        list(GET HWLOC_LIBRARY_DIRS 0 first_lib_path)
+    else()
+        list(GET HWLOC_LIBRARIES 0 first_lib)
+        get_filename_component(first_lib_path "${first_lib}" PATH)
+    endif()
+    if (${first_lib_path} MATCHES "/lib(32|64)?$")
+        string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
+        set(HWLOC_DIR "${not_cached_dir}" CACHE PATH "Installation directory of HWLOC library" FORCE)
+    endif()
+endif()
 
 # check that HWLOC has been found
 # -------------------------------
diff --git a/cmake_modules/morse/find/FindLAPACK.cmake b/cmake_modules/morse/find/FindLAPACK.cmake
index 93f89b27d9a19c2d6ceb33b486b8927248f37d67..1f27e6c9e7477b59df02139cb683d40c69101084 100644
--- a/cmake_modules/morse/find/FindLAPACK.cmake
+++ b/cmake_modules/morse/find/FindLAPACK.cmake
@@ -106,7 +106,7 @@ macro(Print_Find_Library_Blas_Status _libname _lib_to_find)
         endif()
     endif()
     message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n"
-            "- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n"
+            "- Option 1: Provide the installation directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n"
             "- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n"
             "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
             "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}")
@@ -114,7 +114,7 @@ macro(Print_Find_Library_Blas_Status _libname _lib_to_find)
 endmacro()
 
 if (NOT LAPACK_FOUND)
-    set(LAPACK_DIR "" CACHE PATH "Root directory of LAPACK library")
+    set(LAPACK_DIR "" CACHE PATH "Installation directory of LAPACK library")
     if (NOT LAPACK_FIND_QUIETLY)
         message(STATUS "A cache variable, namely LAPACK_DIR, has been set to specify the install directory of LAPACK")
     endif()
@@ -165,8 +165,7 @@ if (NOT _libdir)
         list(APPEND _libdir "${BLAS_DIR}/lib32")
         list(APPEND _libdir "${BLAS_DIR}/lib/ia32")
     endif()
-  endif ()
-  if (BLAS_LIBDIR)
+  elseif (BLAS_LIBDIR)
     list(APPEND _libdir "${BLAS_LIBDIR}")
   endif ()
   if (LAPACK_DIR)
@@ -179,20 +178,20 @@ if (NOT _libdir)
         list(APPEND _libdir "${LAPACK_DIR}/lib32")
         list(APPEND _libdir "${LAPACK_DIR}/lib/ia32")
     endif()
-  endif ()
-  if (LAPACK_LIBDIR)
+  elseif (LAPACK_LIBDIR)
     list(APPEND _libdir "${LAPACK_LIBDIR}")
+  else()
+    if (WIN32)
+      string(REPLACE ":" ";" _libdir2 "$ENV{LIB}")
+    elseif (APPLE)
+      string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}")
+    else ()
+      string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}")
+    endif ()
+    list(APPEND _libdir "${_libdir2}")
+    list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
+    list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
   endif ()
-  if (WIN32)
-    string(REPLACE ":" ";" _libdir2 "$ENV{LIB}")
-  elseif (APPLE)
-    string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}")
-  else ()
-    string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}")
-  endif ()
-  list(APPEND _libdir "${_libdir2}")
-  list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
-  list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
 endif ()
 
 if (LAPACK_VERBOSE)
@@ -367,6 +366,8 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
 
     set(LAPACK_SEARCH_LIBS "")
 
+    set(additional_flags "-Wl,--no-as-needed")
+
     if (BLA_F95)
       set(LAPACK_mkl_SEARCH_SYMBOL "CHEEV")
       set(_LIBRARIES LAPACK95_LIBRARIES)
@@ -399,11 +400,14 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
         ${_LIBRARIES}
         BLAS
         ${LAPACK_mkl_SEARCH_SYMBOL}
-        ""
+        "${additional_flags}"
         ""
         "${_BLAS_LIBRARIES}"
         "${CMAKE_THREAD_LIBS_INIT};${LM}"
         )
+        if(_LIBRARIES)
+            set(LAPACK_LINKER_FLAGS "${additional_flags}")
+        endif()
     endif ()
     # Then try the search libs
     foreach (IT ${LAPACK_SEARCH_LIBS})
@@ -412,11 +416,14 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
           ${_LIBRARIES}
           BLAS
           ${LAPACK_mkl_SEARCH_SYMBOL}
-          ""
+          "${additional_flags}"
           "${IT}"
           "${_BLAS_LIBRARIES}"
           "${CMAKE_THREAD_LIBS_INIT};${LM}"
           )
+          if(_LIBRARIES)
+              set(LAPACK_LINKER_FLAGS "${additional_flags}")
+          endif()
       endif ()
     endforeach ()
   endif ()
@@ -438,7 +445,7 @@ if(BLA_F95)
   else(LAPACK95_FOUND)
     message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but LAPACK 95 libraries could not be found or check of symbols failed."
         "\nPlease indicate where to find LAPACK libraries. You have three options:\n"
-        "- Option 1: Provide the root directory of LAPACK library with cmake option: -DLAPACK_DIR=your/path/to/lapack\n"
+        "- Option 1: Provide the installation directory of LAPACK library with cmake option: -DLAPACK_DIR=your/path/to/lapack\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 -DLAPACK_VERBOSE=ON at cmake configure."
@@ -473,7 +480,7 @@ else(BLA_F95)
   else(LAPACK_FOUND)
     message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but LAPACK libraries could not be found or check of symbols failed."
         "\nPlease indicate where to find LAPACK libraries. You have three options:\n"
-        "- Option 1: Provide the root directory of LAPACK library with cmake option: -DLAPACK_DIR=your/path/to/lapack\n"
+        "- Option 1: Provide the installation directory of LAPACK library with cmake option: -DLAPACK_DIR=your/path/to/lapack\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 -DLAPACK_VERBOSE=ON at cmake configure."
@@ -495,3 +502,12 @@ else(BLA_F95)
 endif(BLA_F95)
 
 set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+
+if (LAPACK_FOUND AND NOT LAPACK_DIR)
+    list(GET LAPACK_LIBRARIES 0 first_lib)
+    get_filename_component(first_lib_path "${first_lib}" PATH)
+    if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)")
+        string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}")
+        set(LAPACK_DIR "${not_cached_dir}" CACHE PATH "Installation directory of LAPACK library" FORCE)
+    endif()
+endif()
diff --git a/cmake_modules/morse/find/FindLAPACKE.cmake b/cmake_modules/morse/find/FindLAPACKE.cmake
index 6ef70b8dcc007fbb35a131b3f092c69662ab5d3d..43c7470295c1b2865b0fb101713729530f0cde07 100644
--- a/cmake_modules/morse/find/FindLAPACKE.cmake
+++ b/cmake_modules/morse/find/FindLAPACKE.cmake
@@ -26,6 +26,7 @@
 # This module finds headers and lapacke library.
 # Results are reported in variables:
 #  LAPACKE_FOUND            - True if headers and requested libraries were found
+#  LAPACKE_LINKER_FLAGS     - list of required linker flags (excluding -l and -L)
 #  LAPACKE_INCLUDE_DIRS     - lapacke include directories
 #  LAPACKE_LIBRARY_DIRS     - Link directories for lapacke libraries
 #  LAPACKE_LIBRARIES        - lapacke component libraries to be linked
@@ -64,7 +65,7 @@
 #  License text for the above reference.)
 
 if (NOT LAPACKE_FOUND)
-    set(LAPACKE_DIR "" CACHE PATH "Root directory of LAPACKE library")
+    set(LAPACKE_DIR "" CACHE PATH "Installation directory of LAPACKE library")
     if (NOT LAPACKE_FIND_QUIETLY)
         message(STATUS "A cache variable, namely LAPACKE_DIR, has been set to specify the install directory of LAPACKE")
     endif()
@@ -102,7 +103,7 @@ if (LAPACK_FOUND)
     if (NOT LAPACKE_STANDALONE)
         # check if a lapacke function exists in the LAPACK lib
         include(CheckFunctionExists)
-        set(CMAKE_REQUIRED_LIBRARIES "${LAPACK_LIBRARIES}")
+        set(CMAKE_REQUIRED_LIBRARIES "${LAPACK_LINKER_FLAGS};${LAPACK_LIBRARIES}")
         unset(LAPACKE_WORKS CACHE)
         check_function_exists(LAPACKE_dgeqrf LAPACKE_WORKS)
         mark_as_advanced(LAPACKE_WORKS)
@@ -114,10 +115,15 @@ if (LAPACK_FOUND)
             endif()
             # test succeeds: LAPACKE is in LAPACK
             set(LAPACKE_LIBRARIES "${LAPACK_LIBRARIES}")
-            set(LAPACKE_LIBRARY_DIRS "${LAPACK_LIBRARY_DIRS}")
+            if (LAPACK_LIBRARY_DIRS)
+                set(LAPACKE_LIBRARY_DIRS "${LAPACK_LIBRARY_DIRS}")
+            endif()
             if(LAPACK_INCLUDE_DIRS)
                 set(LAPACKE_INCLUDE_DIRS "${LAPACK_INCLUDE_DIRS}")
             endif()
+            if (LAPACK_LINKER_FLAGS)
+                set(LAPACKE_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}")
+            endif()
         endif()
     endif (NOT LAPACKE_STANDALONE)
 
@@ -252,6 +258,7 @@ if (LAPACK_FOUND)
         # check a function to validate the find
         if(LAPACKE_LIBRARIES)
 
+            set(REQUIRED_LDFLAGS)
             set(REQUIRED_INCDIRS)
             set(REQUIRED_LIBDIRS)
             set(REQUIRED_LIBS)
@@ -272,11 +279,14 @@ if (LAPACK_FOUND)
                 list(APPEND REQUIRED_LIBDIRS "${LAPACK_LIBRARY_DIRS}")
             endif()
             list(APPEND REQUIRED_LIBS "${LAPACK_LIBRARIES}")
+            if (LAPACK_LINKER_FLAGS)
+                list(APPEND REQUIRED_LDFLAGS "${LAPACK_LINKER_FLAGS}")
+            endif()
             # Fortran
             if (CMAKE_Fortran_COMPILER MATCHES ".+gfortran.*")
-                list(APPEND CMAKE_REQUIRED_LIBRARIES "-lgfortran")
+                list(APPEND REQUIRED_LIBS "-lgfortran")
             elseif (CMAKE_Fortran_COMPILER MATCHES ".+ifort.*")
-                list(APPEND CMAKE_REQUIRED_LIBRARIES "-lifcore")
+                list(APPEND REQUIRED_LIBS "-lifcore")
             endif()
             # m
             list(APPEND REQUIRED_LIBS "-lm")
@@ -284,6 +294,7 @@ if (LAPACK_FOUND)
             # set required libraries for link
             set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
             set(CMAKE_REQUIRED_LIBRARIES)
+            list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
             foreach(lib_dir ${REQUIRED_LIBDIRS})
                 list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
             endforeach()
@@ -300,8 +311,10 @@ if (LAPACK_FOUND)
                 set(LAPACKE_LIBRARIES_DEP "${REQUIRED_LIBS}")
                 set(LAPACKE_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
                 set(LAPACKE_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
+                set(LAPACKE_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
                 list(REMOVE_DUPLICATES LAPACKE_LIBRARY_DIRS_DEP)
                 list(REMOVE_DUPLICATES LAPACKE_INCLUDE_DIRS_DEP)
+                list(REMOVE_DUPLICATES LAPACKE_LINKER_FLAGS)
             else()
                 if(NOT LAPACKE_FIND_QUIETLY)
                     message(STATUS "Looking for lapacke: test of LAPACKE_dgeqrf with lapacke and lapack libraries fails")
@@ -326,6 +339,14 @@ else(LAPACK_FOUND)
 
 endif(LAPACK_FOUND)
 
+if (LAPACKE_LIBRARIES AND NOT LAPACKE_DIR)
+    list(GET LAPACKE_LIBRARIES 0 first_lib)
+    get_filename_component(first_lib_path "${first_lib}" PATH)
+    if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)")
+        string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}")
+        set(LAPACKE_DIR "${not_cached_dir}" CACHE PATH "Installation directory of LAPACKE library" FORCE)
+    endif()
+endif()
 
 # check that LAPACKE has been found
 # ---------------------------------
diff --git a/cmake_modules/morse/find/FindMAGMA.cmake b/cmake_modules/morse/find/FindMAGMA.cmake
index 3438911746ffdfb60cf84fb16f40bd5973821edd..ae93ba634e494837e7def239474276139241f0ca 100644
--- a/cmake_modules/morse/find/FindMAGMA.cmake
+++ b/cmake_modules/morse/find/FindMAGMA.cmake
@@ -27,6 +27,7 @@
 #
 # Results are reported in variables:
 #  MAGMA_FOUND            - True if headers and requested libraries were found
+#  MAGMA_LINKER_FLAGS     - list of required linker flags (excluding -l and -L)
 #  MAGMA_INCLUDE_DIRS     - magma include directories
 #  MAGMA_LIBRARY_DIRS     - Link directories for magma libraries
 #  MAGMA_LIBRARIES        - magma libraries
@@ -59,7 +60,7 @@
 
 
 if(NOT MAGMA_FOUND)
-    set(MAGMA_DIR "" CACHE PATH "Root directory of MAGMA library")
+    set(MAGMA_DIR "" CACHE PATH "Installation directory of MAGMA library")
     if (NOT MAGMA_FIND_QUIETLY)
         message(STATUS "A cache variable, namely MAGMA_DIR, has been set to specify the install directory of MAGMA")
     endif()
@@ -101,7 +102,7 @@ endif()
 # -------------------------------------------------------------------------------------
 include(FindPkgConfig)
 find_package(PkgConfig QUIET)
-if(PKG_CONFIG_EXECUTABLE)
+if(PKG_CONFIG_EXECUTABLE AND NOT MAGMA_DIR)
 
     pkg_search_module(MAGMA magma)
     if (NOT MAGMA_FIND_QUIETLY)
@@ -148,7 +149,7 @@ if(PKG_CONFIG_EXECUTABLE)
     set(MAGMA_LIBRARY_DIRS_DEP "")
     set(MAGMA_LIBRARIES_DEP "")
 
-endif(PKG_CONFIG_EXECUTABLE)
+endif()
 
 # if MAGMA is not found using pkg-config
 if( (NOT PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) OR NOT MAGMA_FOUND )
@@ -278,6 +279,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) OR NOT MAGMA_FOUND )
     # check a function to validate the find
     if (MAGMA_LIBRARIES)
 
+        set(REQUIRED_LDFLAGS)
         set(REQUIRED_INCDIRS)
         set(REQUIRED_LIBDIRS)
         set(REQUIRED_LIBS)
@@ -306,6 +308,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) OR NOT MAGMA_FOUND )
         elseif(CBLAS_LIBRARIES)
             list(APPEND REQUIRED_LIBS "${CBLAS_LIBRARIES}")
         endif()
+        if (BLAS_LINKER_FLAGS)
+            list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")
+        endif()
         # LAPACK
         if (LAPACK_INCLUDE_DIRS)
             list(APPEND REQUIRED_INCDIRS "${LAPACK_INCLUDE_DIRS}")
@@ -314,6 +319,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) OR NOT MAGMA_FOUND )
             list(APPEND REQUIRED_LIBDIRS "${LAPACK_LIBRARY_DIRS}")
         endif()
         list(APPEND REQUIRED_LIBS "${LAPACK_LIBRARIES}")
+        if (LAPACK_LINKER_FLAGS)
+            list(APPEND REQUIRED_LDFLAGS "${LAPACK_LINKER_FLAGS}")
+        endif()
         # CUDA
         if (CUDA_INCLUDE_DIRS)
             list(APPEND REQUIRED_INCDIRS "${CUDA_INCLUDE_DIRS}")
@@ -326,6 +334,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) OR NOT MAGMA_FOUND )
         # set required libraries for link
         set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
         set(CMAKE_REQUIRED_LIBRARIES)
+        list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
         foreach(lib_dir ${REQUIRED_LIBDIRS})
             list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
         endforeach()
@@ -342,8 +351,10 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) OR NOT MAGMA_FOUND )
             set(MAGMA_LIBRARIES_DEP    "${REQUIRED_LIBS}")
             set(MAGMA_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
             set(MAGMA_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
+            set(MAGMA_LINKER_FLAGS     "${REQUIRED_LDFLAGS}")
             list(REMOVE_DUPLICATES MAGMA_LIBRARY_DIRS_DEP)
             list(REMOVE_DUPLICATES MAGMA_INCLUDE_DIRS_DEP)
+            list(REMOVE_DUPLICATES MAGMA_LINKER_FLAGS)
         else()
             if(NOT MAGMA_FIND_QUIETLY)
                 message(STATUS "Looking for magma : test of magma_dgetrf with
@@ -360,6 +371,22 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) OR NOT MAGMA_FOUND )
 
 endif( (NOT PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) OR NOT MAGMA_FOUND )
 
+if (MAGMA_LIBRARIES AND NOT MAGMA_DIR)
+    if (MAGMA_LIBRARY_DIRS)
+        foreach(dir ${MAGMA_LIBRARY_DIRS})
+            if ("${dir}" MATCHES "magma")
+                set(first_lib_path "${dir}")
+            endif()
+        endforeach()
+    else()
+        list(GET MAGMA_LIBRARIES 0 first_lib)
+        get_filename_component(first_lib_path "${first_lib}" PATH)
+    endif()
+    if (${first_lib_path} MATCHES "/lib(32|64)?$")
+        string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
+        set(MAGMA_DIR "${not_cached_dir}" CACHE PATH "Installation directory of MAGMA library" FORCE)
+    endif()
+endif()
 
 # check that MAGMA has been found
 # -------------------------------
diff --git a/cmake_modules/morse/find/FindMETIS.cmake b/cmake_modules/morse/find/FindMETIS.cmake
index 0056f9bd7b1fcef59ab69445d906a0332cb3fc67..f41f788c8ecf320d4fb818a862a67a7b1a5adfeb 100644
--- a/cmake_modules/morse/find/FindMETIS.cmake
+++ b/cmake_modules/morse/find/FindMETIS.cmake
@@ -45,7 +45,7 @@
 #  License text for the above reference.)
 
 if (NOT METIS_FOUND)
-    set(METIS_DIR "" CACHE PATH "Root directory of METIS library")
+    set(METIS_DIR "" CACHE PATH "Installation directory of METIS library")
     if (NOT METIS_FIND_QUIETLY)
         message(STATUS "A cache variable, namely METIS_DIR, has been set to specify the install directory of METIS")
     endif()
@@ -213,6 +213,15 @@ if(METIS_LIBRARIES)
     set(CMAKE_REQUIRED_LIBRARIES)
 endif(METIS_LIBRARIES)
 
+if (METIS_LIBRARIES AND NOT METIS_DIR)
+    list(GET METIS_LIBRARIES 0 first_lib)
+    get_filename_component(first_lib_path "${first_lib}" PATH)
+    if (${first_lib_path} MATCHES "/lib(32|64)?$")
+        string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
+        set(METIS_DIR "${not_cached_dir}" CACHE PATH "Installation directory of METIS library" FORCE)
+    endif()
+endif()
+
 # check that METIS has been found
 # ---------------------------------
 include(FindPackageHandleStandardArgs)
diff --git a/cmake_modules/morse/find/FindMUMPS.cmake b/cmake_modules/morse/find/FindMUMPS.cmake
index 3c0c79fd9db81191bdf07a6e323b3db3f08129d6..7013664589f09246750e664d1a0a4828c95c8669 100644
--- a/cmake_modules/morse/find/FindMUMPS.cmake
+++ b/cmake_modules/morse/find/FindMUMPS.cmake
@@ -32,6 +32,7 @@
 # This module finds headers and mumps library.
 # Results are reported in variables:
 #  MUMPS_FOUND            - True if headers and requested libraries were found
+#  MUMPS_LINKER_FLAGS     - list of required linker flags (excluding -l and -L)
 #  MUMPS_INCLUDE_DIRS     - mumps include directories
 #  MUMPS_LIBRARY_DIRS     - Link directories for mumps libraries
 #  MUMPS_LIBRARIES        - mumps libraries
@@ -62,7 +63,7 @@
 
 
 if (NOT MUMPS_FOUND)
-    set(MUMPS_DIR "" CACHE PATH "Root directory of MUMPS library")
+    set(MUMPS_DIR "" CACHE PATH "Installation directory of MUMPS library")
     if (NOT MUMPS_FIND_QUIETLY)
         message(STATUS "A cache variable, namely MUMPS_DIR, has been set to specify the install directory of MUMPS")
     endif()
@@ -473,6 +474,7 @@ list(REMOVE_DUPLICATES MUMPS_INCLUDE_DIRS)
 # check a function to validate the find
 if(MUMPS_LIBRARIES)
 
+    set(REQUIRED_LDFLAGS)
     set(REQUIRED_INCDIRS)
     set(REQUIRED_LIBDIRS)
     set(REQUIRED_LIBS)
@@ -498,6 +500,9 @@ if(MUMPS_LIBRARIES)
             endif()
         endforeach()
         list(APPEND REQUIRED_LIBS "${SCALAPACK_LIBRARIES}")
+        if (SCALAPACK_LINKER_FLAGS)
+            list(APPEND REQUIRED_LDFLAGS "${SCALAPACK_LINKER_FLAGS}")
+        endif()
     endif()
     # MPI
     if (MUMPS_LOOK_FOR_MPI AND MPI_FOUND)
@@ -505,7 +510,7 @@ if(MUMPS_LIBRARIES)
             list(APPEND REQUIRED_INCDIRS "${MPI_C_INCLUDE_PATH}")
         endif()
         if (MPI_Fortran_LINK_FLAGS)
-            list(APPEND REQUIRED_LIBS "${MPI_Fortran_LINK_FLAGS}")
+            list(APPEND REQUIRED_LDFLAGS "${MPI_Fortran_LINK_FLAGS}")
         endif()
         list(APPEND REQUIRED_LIBS "${MPI_Fortran_LIBRARIES}")
     endif()
@@ -520,6 +525,9 @@ if(MUMPS_LIBRARIES)
             endif()
         endforeach()
         list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}")
+        if (BLAS_LINKER_FLAGS)
+            list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")
+        endif()
     endif()
     # SCOTCH
     if (MUMPS_LOOK_FOR_SCOTCH AND SCOTCH_FOUND)
@@ -557,6 +565,7 @@ if(MUMPS_LIBRARIES)
     # set required libraries for link
     set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
     set(CMAKE_REQUIRED_LIBRARIES)
+    list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
     foreach(lib_dir ${REQUIRED_LIBDIRS})
         list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
     endforeach()
@@ -587,8 +596,10 @@ if(MUMPS_LIBRARIES)
         set(MUMPS_LIBRARIES_DEP "${REQUIRED_LIBS}")
         set(MUMPS_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
         set(MUMPS_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
+        set(MUMPS_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
         list(REMOVE_DUPLICATES MUMPS_LIBRARY_DIRS_DEP)
         list(REMOVE_DUPLICATES MUMPS_INCLUDE_DIRS_DEP)
+        list(REMOVE_DUPLICATES MUMPS_LINKER_FLAGS)
     else()
         if(NOT MUMPS_FIND_QUIETLY)
             message(STATUS "Looking for MUMPS : test of [sdcz]mumps() fails")
@@ -605,6 +616,14 @@ if(MUMPS_LIBRARIES)
     set(CMAKE_REQUIRED_LIBRARIES)
 endif(MUMPS_LIBRARIES)
 
+if (MUMPS_LIBRARIES AND NOT MUMPS_DIR)
+    list(GET MUMPS_LIBRARIES 0 first_lib)
+    get_filename_component(first_lib_path "${first_lib}" PATH)
+    if (${first_lib_path} MATCHES "/lib(32|64)?$")
+        string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
+        set(MUMPS_DIR "${not_cached_dir}" CACHE PATH "Installation directory of MUMPS library" FORCE)
+    endif()
+endif()
 
 # check that MUMPS has been found
 # -------------------------------
diff --git a/cmake_modules/morse/find/FindPARMETIS.cmake b/cmake_modules/morse/find/FindPARMETIS.cmake
index c009e48c36bce89236582e33ed21b2cb5db65530..75e59a4f0528acbd7dd537cd896160275f378298 100644
--- a/cmake_modules/morse/find/FindPARMETIS.cmake
+++ b/cmake_modules/morse/find/FindPARMETIS.cmake
@@ -45,7 +45,7 @@
 #  License text for the above reference.)
 
 if (NOT PARMETIS_FOUND)
-    set(PARMETIS_DIR "" CACHE PATH "Root directory of PARMETIS library")
+    set(PARMETIS_DIR "" CACHE PATH "Installation directory of PARMETIS library")
     if (NOT PARMETIS_FIND_QUIETLY)
         message(STATUS "A cache variable, namely PARMETIS_DIR, has been set to specify the install directory of PARMETIS")
     endif()
@@ -213,6 +213,14 @@ if(PARMETIS_LIBRARIES)
     set(CMAKE_REQUIRED_LIBRARIES)
 endif(PARMETIS_LIBRARIES)
 
+if (PARMETIS_LIBRARIES AND NOT PARMETIS_DIR)
+    list(GET PARMETIS_LIBRARIES 0 first_lib)
+    get_filename_component(first_lib_path "${first_lib}" PATH)
+    if (${first_lib_path} MATCHES "/lib(32|64)?$")
+        string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
+        set(PARMETIS_DIR "${not_cached_dir}" CACHE PATH "Installation directory of PARMETIS library" FORCE)
+    endif()
+endif()
 
 # check that PARMETIS has been found
 # ----------------------------------
diff --git a/cmake_modules/morse/find/FindPASTIX.cmake b/cmake_modules/morse/find/FindPASTIX.cmake
index ff72836cdcb1fdad9c6808ff1fa1235bb2c563bb..848290f3993abfd8be26622009b6e4753e10629c 100644
--- a/cmake_modules/morse/find/FindPASTIX.cmake
+++ b/cmake_modules/morse/find/FindPASTIX.cmake
@@ -38,6 +38,7 @@
 # This module finds headers and pastix library.
 # Results are reported in variables:
 #  PASTIX_FOUND            - True if headers and requested libraries were found
+#  PASTIX_LINKER_FLAGS     - list of required linker flags (excluding -l and -L)
 #  PASTIX_INCLUDE_DIRS     - pastix include directories
 #  PASTIX_LIBRARY_DIRS     - Link directories for pastix libraries
 #  PASTIX_LIBRARIES        - pastix libraries
@@ -70,7 +71,7 @@
 
 
 if (NOT PASTIX_FOUND)
-    set(PASTIX_DIR "" CACHE PATH "Root directory of PASTIX library")
+    set(PASTIX_DIR "" CACHE PATH "Installation directory of PASTIX library")
     if (NOT PASTIX_FIND_QUIETLY)
         message(STATUS "A cache variable, namely PASTIX_DIR, has been set to specify the install directory of PASTIX")
     endif()
@@ -461,10 +462,10 @@ endforeach(pastix_lib ${PASTIX_libs_to_find})
 # check a function to validate the find
 if(PASTIX_LIBRARIES)
 
+    set(REQUIRED_LDFLAGS)
     set(REQUIRED_INCDIRS)
     set(REQUIRED_LIBDIRS)
     set(REQUIRED_LIBS)
-    set(REQUIRED_FLAGS)
 
     # PASTIX
     if (PASTIX_INCLUDE_DIRS)
@@ -518,7 +519,7 @@ if(PASTIX_LIBRARIES)
             list(APPEND REQUIRED_INCDIRS "${MPI_C_INCLUDE_PATH}")
         endif()
         if (MPI_C_LINK_FLAGS)
-            list(APPEND REQUIRED_FLAGS "${MPI_C_LINK_FLAGS}")
+            list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}")
         endif()
         list(APPEND REQUIRED_LIBS "${MPI_C_LIBRARIES}")
     endif()
@@ -551,6 +552,9 @@ if(PASTIX_LIBRARIES)
             endif()
         endforeach()
         list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}")
+        if (BLAS_LINKER_FLAGS)
+            list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")
+        endif()
     endif()
     # SCOTCH
     if (PASTIX_LOOK_FOR_SCOTCH AND SCOTCH_FOUND)
@@ -594,6 +598,7 @@ if(PASTIX_LIBRARIES)
     # set required libraries for link
     set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
     set(CMAKE_REQUIRED_LIBRARIES)
+    list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
     foreach(lib_dir ${REQUIRED_LIBDIRS})
         list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
     endforeach()
@@ -608,15 +613,13 @@ if(PASTIX_LIBRARIES)
 
     if(PASTIX_WORKS)
         # save link with dependencies
-        if (REQUIRED_FLAGS)
-            set(PASTIX_LIBRARIES_DEP "${REQUIRED_FLAGS};${REQUIRED_LIBS}")
-        else()
-            set(PASTIX_LIBRARIES_DEP "${REQUIRED_LIBS}")
-        endif()
+        set(PASTIX_LIBRARIES_DEP "${REQUIRED_LIBS}")
         set(PASTIX_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
         set(PASTIX_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
+        set(PASTIX_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
         list(REMOVE_DUPLICATES PASTIX_LIBRARY_DIRS_DEP)
         list(REMOVE_DUPLICATES PASTIX_INCLUDE_DIRS_DEP)
+        list(REMOVE_DUPLICATES PASTIX_LINKER_FLAGS)
     else()
         if(NOT PASTIX_FIND_QUIETLY)
             message(STATUS "Looking for PASTIX : test of pastix() fails")
@@ -633,6 +636,14 @@ if(PASTIX_LIBRARIES)
     set(CMAKE_REQUIRED_LIBRARIES)
 endif(PASTIX_LIBRARIES)
 
+if (PASTIX_LIBRARIES AND NOT PASTIX_DIR)
+    list(GET PASTIX_LIBRARIES 0 first_lib)
+    get_filename_component(first_lib_path "${first_lib}" PATH)
+    if (${first_lib_path} MATCHES "/lib(32|64)?$")
+        string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
+        set(PASTIX_DIR "${not_cached_dir}" CACHE PATH "Installation directory of PASTIX library" FORCE)
+    endif()
+endif()
 
 # check that PASTIX has been found
 # ---------------------------------
diff --git a/cmake_modules/morse/find/FindPTSCOTCH.cmake b/cmake_modules/morse/find/FindPTSCOTCH.cmake
index b9fac6d555de590dccc66da3a927e42e456ac3ac..bb62202212ee0f5b02827107474338e4d03d6053 100644
--- a/cmake_modules/morse/find/FindPTSCOTCH.cmake
+++ b/cmake_modules/morse/find/FindPTSCOTCH.cmake
@@ -21,6 +21,7 @@
 # This module finds headers and ptscotch library.
 # Results are reported in variables:
 #  PTSCOTCH_FOUND            - True if headers and requested libraries were found
+#  PTSCOTCH_LINKER_FLAGS     - list of required linker flags (excluding -l and -L)
 #  PTSCOTCH_INCLUDE_DIRS     - ptscotch include directories
 #  PTSCOTCH_LIBRARY_DIRS     - Link directories for ptscotch libraries
 #  PTSCOTCH_LIBRARIES        - ptscotch component libraries to be linked
@@ -53,7 +54,7 @@
 #  License text for the above reference.)
 
 if (NOT PTSCOTCH_FOUND)
-    set(PTSCOTCH_DIR "" CACHE PATH "Root directory of PTSCOTCH library")
+    set(PTSCOTCH_DIR "" CACHE PATH "Installation directory of PTSCOTCH library")
     if (NOT PTSCOTCH_FIND_QUIETLY)
         message(STATUS "A cache variable, namely PTSCOTCH_DIR, has been set to specify the install directory of PTSCOTCH")
     endif()
@@ -212,10 +213,10 @@ endforeach()
 # check a function to validate the find
 if(PTSCOTCH_LIBRARIES)
 
+    set(REQUIRED_LDFLAGS)
     set(REQUIRED_INCDIRS)
     set(REQUIRED_LIBDIRS)
     set(REQUIRED_LIBS)
-    set(REQUIRED_FLAGS)
 
     # PTSCOTCH
     if (PTSCOTCH_INCLUDE_DIRS)
@@ -231,7 +232,7 @@ if(PTSCOTCH_LIBRARIES)
             list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}")
         endif()
         if (MPI_C_LINK_FLAGS)
-            list(APPEND REQUIRED_FLAGS "${MPI_C_LINK_FLAGS}")
+            list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}")
         endif()
         list(APPEND REQUIRED_LIBS "${MPI_C_LIBRARIES}")
     endif()
@@ -243,6 +244,7 @@ if(PTSCOTCH_LIBRARIES)
     # set required libraries for link
     set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
     set(CMAKE_REQUIRED_LIBRARIES)
+    list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
     foreach(lib_dir ${REQUIRED_LIBDIRS})
         list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
     endforeach()
@@ -257,15 +259,13 @@ if(PTSCOTCH_LIBRARIES)
 
     if(PTSCOTCH_WORKS)
         # save link with dependencies
-        if (REQUIRED_FLAGS)
-            set(PTSCOTCH_LIBRARIES_DEP "${REQUIRED_FLAGS};${REQUIRED_LIBS}")
-        else()
-            set(PTSCOTCH_LIBRARIES_DEP "${REQUIRED_LIBS}")
-        endif()
+        set(PTSCOTCH_LIBRARIES_DEP "${REQUIRED_LIBS}")
         set(PTSCOTCH_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
         set(PTSCOTCH_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
+        set(PTSCOTCH_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
         list(REMOVE_DUPLICATES PTSCOTCH_LIBRARY_DIRS_DEP)
         list(REMOVE_DUPLICATES PTSCOTCH_INCLUDE_DIRS_DEP)
+        list(REMOVE_DUPLICATES PTSCOTCH_LINKER_FLAGS)
     else()
         if(NOT PTSCOTCH_FIND_QUIETLY)
             message(STATUS "Looking for PTSCOTCH : test of SCOTCH_dgraphInit with PTSCOTCH library fails")
@@ -279,6 +279,14 @@ if(PTSCOTCH_LIBRARIES)
     set(CMAKE_REQUIRED_LIBRARIES)
 endif(PTSCOTCH_LIBRARIES)
 
+if (PTSCOTCH_LIBRARIES AND NOT PTSCOTCH_DIR)
+    list(GET PTSCOTCH_LIBRARIES 0 first_lib)
+    get_filename_component(first_lib_path "${first_lib}" PATH)
+    if (${first_lib_path} MATCHES "/lib(32|64)?$")
+        string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
+        set(PTSCOTCH_DIR "${not_cached_dir}" CACHE PATH "Installation directory of PTSCOTCH library" FORCE)
+    endif()
+endif()
 
 # Check the size of SCOTCH_Num
 # ---------------------------------
diff --git a/cmake_modules/morse/find/FindQUARK.cmake b/cmake_modules/morse/find/FindQUARK.cmake
index 5ac3a64bbcc5e561c08ec06ff772d7d20033e74e..1f0baa12df7428d76a04d4ade611ac80698ab260 100644
--- a/cmake_modules/morse/find/FindQUARK.cmake
+++ b/cmake_modules/morse/find/FindQUARK.cmake
@@ -58,7 +58,7 @@
 
 
 if (NOT QUARK_FOUND)
-    set(QUARK_DIR "" CACHE PATH "Root directory of QUARK library")
+    set(QUARK_DIR "" CACHE PATH "Installation directory of QUARK library")
     if (NOT QUARK_FIND_QUIETLY)
         message(STATUS "A cache variable, namely QUARK_DIR, has been set to specify the install directory of QUARK")
     endif()
@@ -282,6 +282,14 @@ if(QUARK_LIBRARIES)
     set(CMAKE_REQUIRED_LIBRARIES)
 endif(QUARK_LIBRARIES)
 
+if (QUARK_LIBRARIES AND NOT QUARK_DIR)
+    list(GET QUARK_LIBRARIES 0 first_lib)
+    get_filename_component(first_lib_path "${first_lib}" PATH)
+    if (${first_lib_path} MATCHES "/lib(32|64)?$")
+        string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
+        set(QUARK_DIR "${not_cached_dir}" CACHE PATH "Installation directory of QUARK library" FORCE)
+    endif()
+endif()
 
 # check that QUARK has been found
 # ---------------------------------
diff --git a/cmake_modules/morse/find/FindSCALAPACK.cmake b/cmake_modules/morse/find/FindSCALAPACK.cmake
index 4d9151880e88dbf9f488957dc7b7b447397d0ec0..e8107788cf2ab51f10612113d2796d9fc14bb1a7 100644
--- a/cmake_modules/morse/find/FindSCALAPACK.cmake
+++ b/cmake_modules/morse/find/FindSCALAPACK.cmake
@@ -103,7 +103,7 @@ macro(Print_Find_Library_Blas_Status _libname _lib_to_find)
         endif()
     endif()
     message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n"
-            "- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n"
+            "- Option 1: Provide the installation directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n"
             "- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n"
             "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
             "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}")
@@ -111,7 +111,7 @@ macro(Print_Find_Library_Blas_Status _libname _lib_to_find)
 endmacro()
 
 if (NOT SCALAPACK_FOUND)
-    set(SCALAPACK_DIR "" CACHE PATH "Root directory of SCALAPACK library")
+    set(SCALAPACK_DIR "" CACHE PATH "Installation directory of SCALAPACK library")
     if (NOT SCALAPACK_FIND_QUIETLY)
         message(STATUS "A cache variable, namely SCALAPACK_DIR, has been set to specify the install directory of SCALAPACK")
     endif()
@@ -163,7 +163,7 @@ if (NOT _libdir)
         list(APPEND _libdir "${BLAS_DIR}/lib/ia32")
     endif()
   endif ()
-  if (BLAS_LIBDIR)
+  elseif (BLAS_LIBDIR)
     list(APPEND _libdir "${BLAS_LIBDIR}")
   endif ()
   if (SCALAPACK_DIR)
@@ -177,19 +177,20 @@ if (NOT _libdir)
         list(APPEND _libdir "${SCALAPACK_DIR}/lib/ia32")
     endif()
   endif ()
-  if (SCALAPACK_LIBDIR)
+  elseif (SCALAPACK_LIBDIR)
     list(APPEND _libdir "${SCALAPACK_LIBDIR}")
+  else()
+    if (WIN32)
+      string(REPLACE ":" ";" _libdir2 "$ENV{LIB}")
+    elseif (APPLE)
+      string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}")
+    else ()
+      string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}")
+    endif ()
+    list(APPEND _libdir "${_libdir2}")
+    list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
+    list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
   endif ()
-  if (WIN32)
-    string(REPLACE ":" ";" _libdir2 "$ENV{LIB}")
-  elseif (APPLE)
-    string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}")
-  else ()
-    string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}")
-  endif ()
-  list(APPEND _libdir "${_libdir2}")
-  list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
-  list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
 endif ()
 
 if (SCALAPACK_VERBOSE)
@@ -391,7 +392,7 @@ if(BLA_F95)
   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 root directory of SCALAPACK library with cmake option: -DSCALAPACK_DIR=your/path/to/scalapack\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."
@@ -426,7 +427,7 @@ else(BLA_F95)
   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 root directory of SCALAPACK library with cmake option: -DSCALAPACK_DIR=your/path/to/scalapack\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."
@@ -448,3 +449,12 @@ else(BLA_F95)
 endif(BLA_F95)
 
 set(CMAKE_FIND_LIBRARY_SUFFIXES ${_scalapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+
+if (SCALAPACK_LIBRARIES AND NOT SCALAPACK_DIR)
+    list(GET SCALAPACK_LIBRARIES 0 first_lib)
+    get_filename_component(first_lib_path "${first_lib}" PATH)
+    if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)")
+        string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}")
+        set(SCALAPACK_DIR "${not_cached_dir}" CACHE PATH "Installation directory of SCALAPACK library" FORCE)
+    endif()
+endif()
diff --git a/cmake_modules/morse/find/FindSCOTCH.cmake b/cmake_modules/morse/find/FindSCOTCH.cmake
index 1be82357830851cd28c5a0d07bb1fd4567aa035d..8b7eace5d6e52d23637150c32d9c6fbc68d09fef 100644
--- a/cmake_modules/morse/find/FindSCOTCH.cmake
+++ b/cmake_modules/morse/find/FindSCOTCH.cmake
@@ -46,7 +46,7 @@
 #  License text for the above reference.)
 
 if (NOT SCOTCH_FOUND)
-    set(SCOTCH_DIR "" CACHE PATH "Root directory of SCOTCH library")
+    set(SCOTCH_DIR "" CACHE PATH "Installation directory of SCOTCH library")
     if (NOT SCOTCH_FIND_QUIETLY)
         message(STATUS "A cache variable, namely SCOTCH_DIR, has been set to specify the install directory of SCOTCH")
     endif()
@@ -210,7 +210,7 @@ if(SCOTCH_LIBRARIES)
     set(REQUIRED_LIBS "${SCOTCH_LIBRARIES}")
     # THREADS
     if(CMAKE_THREAD_LIBS_INIT)
-        list(APPEND CMAKE_REQUIRED_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
+        list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}")
     endif()
 
     # set required libraries for link
@@ -243,6 +243,14 @@ if(SCOTCH_LIBRARIES)
     set(CMAKE_REQUIRED_LIBRARIES)
 endif(SCOTCH_LIBRARIES)
 
+if (SCOTCH_LIBRARIES AND NOT SCOTCH_DIR)
+    list(GET SCOTCH_LIBRARIES 0 first_lib)
+    get_filename_component(first_lib_path "${first_lib}" PATH)
+    if (${first_lib_path} MATCHES "/lib(32|64)?$")
+        string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
+        set(SCOTCH_DIR "${not_cached_dir}" CACHE PATH "Installation directory of SCOTCH library" FORCE)
+    endif()
+endif()
 
 # Check the size of SCOTCH_Num
 # ---------------------------------
diff --git a/cmake_modules/morse/find/FindSTARPU.cmake b/cmake_modules/morse/find/FindSTARPU.cmake
index 195fce882f581d6be8db129446c18611cb57a142..9da54b2db1ce1a5a28714a3e32766f20a60effb8 100644
--- a/cmake_modules/morse/find/FindSTARPU.cmake
+++ b/cmake_modules/morse/find/FindSTARPU.cmake
@@ -28,14 +28,16 @@
 #
 # Results are reported in variables:
 #  STARPU_FOUND                  - True if headers and requested libraries were found
+#  STARPU_C_FLAGS                - list of required compilation flags (excluding -I)
+#  STARPU_LINKER_FLAGS           - list of required linker flags (excluding -l and -L)
 #  STARPU_INCLUDE_DIRS           - starpu include directories
 #  STARPU_LIBRARY_DIRS           - Link directories for starpu libraries
 #  STARPU_LIBRARIES              - starpu libraries
 #  STARPU_SHM_LIBRARIES          - starpu libraries without libstarpumpi
 #  STARPU_MPI_LIBRARIES          - starpu libraries with libstarpumpi
-#  STARPU_INCLUDE_DIRS_DEP        - starpu + dependencies include directories
-#  STARPU_LIBRARY_DIRS_DEP        - starpu + dependencies link directories
-#  STARPU_LIBRARIES_DEP           - starpu libraries + dependencies
+#  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_MAJOR          - The major version of the package found
 #  STARPU_VERSION_MINOR          - The minor version of the package found
@@ -64,7 +66,7 @@
 #  License text for the above reference.)
 
 if (NOT STARPU_FOUND)
-    set(STARPU_DIR "" CACHE PATH "Root directory of STARPU library")
+    set(STARPU_DIR "" CACHE PATH "Installation directory of STARPU library")
     if (NOT STARPU_FIND_QUIETLY)
         message(STATUS "A cache variable, namely STARPU_DIR, has been set to specify the install directory of STARPU")
     endif()
@@ -167,7 +169,7 @@ endif()
 include(FindPkgConfig)
 find_package(PkgConfig QUIET)
 
-if(PKG_CONFIG_EXECUTABLE)
+if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_DIR)
 
     pkg_search_module(STARPU_SHM libstarpu)
     set(STARPU_INCLUDE_DIRS "${STARPU_SHM_INCLUDE_DIRS}")
@@ -228,7 +230,7 @@ if(PKG_CONFIG_EXECUTABLE)
         set(STARPU_LIBRARIES "STARPU_LIBRARIES-NOTFOUND")
     endif()
 
-endif(PKG_CONFIG_EXECUTABLE)
+endif()
 
 
 if( (NOT PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND) OR
@@ -603,10 +605,11 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND) OR
     # check a function to validate the find
     if(STARPU_LIBRARIES)
 
+        set(REQUIRED_FLAGS)
+        set(REQUIRED_LDFLAGS)
         set(REQUIRED_INCDIRS)
         set(REQUIRED_LIBDIRS)
         set(REQUIRED_LIBS)
-        set(REQUIRED_FLAGS)
 
         # STARPU
         if (STARPU_INCLUDE_DIRS)
@@ -641,7 +644,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND) OR
                 list(APPEND REQUIRED_INCDIRS "${MPI_C_INCLUDE_PATH}")
             endif()
             if (MPI_C_LINK_FLAGS)
-                list(APPEND REQUIRED_FLAGS "${MPI_C_LINK_FLAGS}")
+                list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}")
             endif()
             list(APPEND REQUIRED_LIBS "${MPI_C_LIBRARIES}")
         endif()
@@ -668,6 +671,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND) OR
                     endif()
                 endforeach()
             endif()
+            if (MAGMA_LINKER_FLAGS)
+                list(APPEND REQUIRED_LDFLAGS "${MAGMA_LINKER_FLAGS}")
+            endif()
         endif()
         # CUDA
         if (CUDA_FOUND AND STARPU_LOOK_FOR_CUDA)
@@ -704,6 +710,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND) OR
                 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}")
+            endif()
         endif()
         # Fortran
         if (CMAKE_Fortran_COMPILER MATCHES ".+gfortran.*")
@@ -715,6 +724,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND) OR
         # set required libraries for link
         set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
         set(CMAKE_REQUIRED_LIBRARIES)
+        list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
         foreach(lib_dir ${REQUIRED_LIBDIRS})
             list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
         endforeach()
@@ -736,8 +746,10 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND) OR
             endif()
             set(STARPU_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
             set(STARPU_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
+            set(STARPU_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
             list(REMOVE_DUPLICATES STARPU_LIBRARY_DIRS_DEP)
             list(REMOVE_DUPLICATES STARPU_INCLUDE_DIRS_DEP)
+            list(REMOVE_DUPLICATES STARPU_LINKER_FLAGS)
         else()
             if(NOT STARPU_FIND_QUIETLY)
                 message(STATUS "Looking for starpu : test of starpu_init fails")
@@ -758,6 +770,22 @@ endif( (NOT PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND) OR
        (NOT STARPU_SHM_FOUND OR (NOT STARPU_MPI_FOUND AND STARPU_LOOK_FOR_MPI))
      )
 
+if (STARPU_LIBRARIES AND NOT STARPU_DIR)
+    if (STARPU_LIBRARY_DIRS)
+        foreach(dir ${STARPU_LIBRARY_DIRS})
+            if ("${dir}" MATCHES "starpu")
+                set(first_lib_path "${dir}")
+            endif()
+        endforeach()
+    else()
+        list(GET STARPU_LIBRARIES 0 first_lib)
+        get_filename_component(first_lib_path "${first_lib}" PATH)
+    endif()
+    if (${first_lib_path} MATCHES "/lib(32|64)?$")
+        string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
+        set(STARPU_DIR "${not_cached_dir}" CACHE PATH "Installation directory of STARPU library" FORCE)
+    endif()
+endif()
 
 # check that STARPU has been found
 # --------------------------------
diff --git a/cmake_modules/morse/find/FindTMG.cmake b/cmake_modules/morse/find/FindTMG.cmake
index d781da4096465eb0a6fadc1e748f832eeef6524b..83b65ad49e7da447183a6e21d67499f16f866cc0 100644
--- a/cmake_modules/morse/find/FindTMG.cmake
+++ b/cmake_modules/morse/find/FindTMG.cmake
@@ -17,6 +17,7 @@
 # This module finds headers and tmg library.
 # Results are reported in variables:
 #  TMG_FOUND            - True if headers and requested libraries were found
+#  TMG_LINKER_FLAGS     - list of required linker flags (excluding -l and -L)
 #  TMG_INCLUDE_DIRS     - tmg include directories
 #  TMG_LIBRARY_DIRS     - Link directories for tmg libraries
 #  TMG_LIBRARIES        - tmg component libraries to be linked
@@ -49,7 +50,7 @@
 
 
 if (NOT TMG_FOUND)
-    set(TMG_DIR "" CACHE PATH "Root directory of TMG library")
+    set(TMG_DIR "" CACHE PATH "Installation directory of TMG library")
     if (NOT TMG_FIND_QUIETLY)
         message(STATUS "A cache variable, namely TMG_DIR, has been set to specify the install directory of TMG")
     endif()
@@ -77,7 +78,7 @@ endif()
 if (LAPACK_FOUND)
 
     # check if a tmg function exists in the LAPACK lib
-    set(CMAKE_REQUIRED_LIBRARIES "${LAPACK_LIBRARIES}")
+    set(CMAKE_REQUIRED_LIBRARIES "${LAPACK_LINKER_FLAGS};${LAPACK_LIBRARIES}")
     include(CheckFunctionExists)
     include(CheckFortranFunctionExists)
     unset(TMG_WORKS CACHE)
@@ -103,10 +104,15 @@ if (LAPACK_FOUND)
         endif()
         # test succeeds: TMG is in LAPACK
         set(TMG_LIBRARIES "${LAPACK_LIBRARIES}")
-        set(TMG_LIBRARY_DIRS "${LAPACK_LIBRARY_DIRS}")
+        if (LAPACK_LIBRARY_DIRS)
+            set(TMG_LIBRARY_DIRS "${LAPACK_LIBRARY_DIRS}")
+        endif()
         if(LAPACK_INCLUDE_DIRS)
             set(TMG_INCLUDE_DIRS "${LAPACK_INCLUDE_DIRS}")
         endif()
+        if (LAPACK_LINKER_FLAGS)
+            set(TMG_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}")
+        endif()
     else()
 
         if(NOT TMG_FIND_QUIETLY)
@@ -181,6 +187,7 @@ if (LAPACK_FOUND)
         # check a function to validate the find
         if(TMG_LIBRARIES)
 
+            set(REQUIRED_LDFLAGS)
             set(REQUIRED_INCDIRS)
             set(REQUIRED_LIBDIRS)
             set(REQUIRED_LIBS)
@@ -201,10 +208,14 @@ if (LAPACK_FOUND)
                 list(APPEND REQUIRED_LIBDIRS "${LAPACK_LIBRARY_DIRS}")
             endif()
             list(APPEND REQUIRED_LIBS "${LAPACK_LIBRARIES}")
+            if (LAPACK_LINKER_FLAGS)
+                list(APPEND REQUIRED_LDFLAGS "${LAPACK_LINKER_FLAGS}")
+            endif()
 
             # set required libraries for link
             set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
             set(CMAKE_REQUIRED_LIBRARIES)
+            list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
             foreach(lib_dir ${REQUIRED_LIBDIRS})
                 list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
             endforeach()
@@ -234,8 +245,10 @@ if (LAPACK_FOUND)
                 set(TMG_LIBRARIES_DEP "${REQUIRED_LIBS}")
                 set(TMG_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
                 set(TMG_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
+                set(TMG_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
                 list(REMOVE_DUPLICATES TMG_LIBRARY_DIRS_DEP)
                 list(REMOVE_DUPLICATES TMG_INCLUDE_DIRS_DEP)
+                list(REMOVE_DUPLICATES TMG_LINKER_FLAGS)
             else()
                 if(NOT TMG_FIND_QUIETLY)
                     message(STATUS "Looking for tmg: test of dlarnv and dlagsy with tmg and lapack libraries fails")
@@ -260,6 +273,14 @@ else()
 
 endif()
 
+if (TMG_LIBRARIES AND NOT TMG_DIR)
+    list(GET TMG_LIBRARIES 0 first_lib)
+    get_filename_component(first_lib_path "${first_lib}" PATH)
+    if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)")
+        string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}")
+        set(TMG_DIR "${not_cached_dir}" CACHE PATH "Installation directory of TMG library" FORCE)
+    endif()
+endif()
 
 # check that TMG has been found
 # -------------------------------