Salome HOME
Improved detection of mpi compilers
authorNDJINGA Michael <ndjinga@is224593.intra.cea.fr>
Thu, 20 Jan 2022 14:30:09 +0000 (15:30 +0100)
committerNDJINGA Michael <ndjinga@is224593.intra.cea.fr>
Thu, 20 Jan 2022 14:30:09 +0000 (15:30 +0100)
CMakeLists.txt

index 237fb4765d731bf93aaca00fcbd76de72dccb559..16fb08e55354bed27abc349ff5d997994d55edb1 100644 (file)
@@ -76,6 +76,14 @@ if(    DEFINED ENV{MPI_HOME} OR MPI_HOME )
     set ( MPI_LIBRARY ${MPI_HOME}/lib/libmpi.so )
   endif(${MPI_LIBRARY} STREQUAL "MPI_LIBRARY-NOTFOUND")
   message ( STATUS "MPI executable is ${MPIEXEC}" )
+  if   (NOT DEFINED CMAKE_CXX_COMPILER)
+    set(CMAKE_CXX_COMPILER ${MPI_HOME}/bin/mpic++)
+  endif(NOT DEFINED CMAKE_CXX_COMPILER)
+  message ( STATUS "MPI C++ compiler is ${CMAKE_CXX_COMPILER}" )
+  if   (NOT DEFINED CMAKE_C_COMPILER)
+    set(CMAKE_C_COMPILER ${MPI_HOME}/bin/mpicc)
+  endif(NOT DEFINED CMAKE_C_COMPILER)
+  message ( STATUS "MPI C compiler is ${CMAKE_C_COMPILER}" )
 else(  DEFINED ENV{MPI_HOME} OR MPI_HOME )
   set(SOLVERLAB_WITH_MPI OFF)
 endif( DEFINED ENV{MPI_HOME} OR MPI_HOME )