From 12f9ec3b1a2e8d46bc595e9001f51a24c49126cc Mon Sep 17 00:00:00 2001
From: Florent Pruvost <florent.pruvost@inria.fr>
Date: Wed, 2 Dec 2015 15:01:55 +0000
Subject: [PATCH] when giving all the path to the libmpi.so it fails, use -lmpi
 instead

---
 CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c2ad454b7..1d0483967 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -619,7 +619,9 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/")
             endif()
             if (CHAMELEON_USE_MPI AND STARPU_MPI_LIBRARIES)
                 # Check if a specific function exist
-                set(CMAKE_REQUIRED_LIBRARIES "${STARPU_MPI_LIBRARIES} ${MPI_C_LIBRARIES}")
+                list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}")
+                list(APPEND CMAKE_REQUIRED_FLAGS "${MPI_C_LINK_FLAGS}")
+                set(CMAKE_REQUIRED_LIBRARIES "${STARPU_MPI_LIBRARIES} -lmpi")
                 unset(STARPU_MPI_DATA_REGISTER_FOUND CACHE)
                 check_function_exists(starpu_mpi_data_register_comm STARPU_MPI_DATA_REGISTER_FOUND)
                 if ( STARPU_MPI_DATA_REGISTER_FOUND )
-- 
GitLab