diff --git a/CMakeLists.txt b/CMakeLists.txt
index 58f346f2a3a764025630704cbc61adbff4d9ff50..4f5cb68ce20f24507240b8a4d29a64e068dce574 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -471,7 +471,7 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/")
             # -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90
             # at cmake configure
             if(NOT MPI_C_COMPILER)
-            set(MPI_C_COMPILER mpicc)
+                set(MPI_C_COMPILER mpicc)
             endif()
             find_package(MPI REQUIRED)
 
@@ -534,7 +534,7 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/")
             # -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90
             # at cmake configure
             if(NOT MPI_C_COMPILER)
-                set(MPI_C_COMPILER smpicc)
+                set(MPI_C_COMPILER "${SIMGRID_DIR_FOUND}/bin/smpicc")
             endif()
             if(NOT MPI_C_LIBRARIES)
                 set(MPI_C_LIBRARIES "${SIMGRID_LIBRARIES}")
@@ -600,7 +600,9 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/")
             foreach(libdir ${STARPU_LIBRARY_DIRS_DEP})
                 list(APPEND CMAKE_REQUIRED_FLAGS "-L${libdir}")
             endforeach()
-            list(APPEND CMAKE_REQUIRED_FLAGS "-include" "starpu_simgrid_wrap.h")
+            if (CHAMELEON_SIMULATION)
+                list(APPEND CMAKE_REQUIRED_FLAGS "-include" "starpu_simgrid_wrap.h")
+            endif()
             string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
             set(CMAKE_REQUIRED_LIBRARIES "${STARPU_LIBRARIES_DEP}")
             check_function_exists(starpu_data_idle_prefetch_on_node STARPU_IDLE_PREFETCH_FOUND)
@@ -632,10 +634,8 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/")
                 list(APPEND CMAKE_REQUIRED_FLAGS "${MPI_C_LINK_FLAGS}")
                 set(CMAKE_REQUIRED_LIBRARIES "${STARPU_LIBRARIES_DEP}")
                 list(APPEND CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}")
-                if (CHAMELEON_SIMULATION)
-                    set(CMAKE_REQUIRED_LIBRARIES "${STARPU_LIBRARIES_DEP}")
-                else()
-                    set(CMAKE_REQUIRED_LIBRARIES "${STARPU_LIBRARIES_DEP} -lmpi")
+                if (NOT CHAMELEON_SIMULATION)
+                    list(APPEND CMAKE_REQUIRED_LIBRARIES "mpi")
                 endif()
                 unset(STARPU_MPI_DATA_REGISTER_FOUND CACHE)
                 check_function_exists(starpu_mpi_data_register_comm STARPU_MPI_DATA_REGISTER_FOUND)