]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Fix MPI version detection for newer cmake 6421/head
authorMatthias Maier <tamiko@43-1.org>
Tue, 1 May 2018 23:39:02 +0000 (18:39 -0500)
committerMatthias Maier <tamiko@43-1.org>
Tue, 1 May 2018 23:40:44 +0000 (18:40 -0500)
cmake/modules/FindMPI.cmake

index 5b5efb019523eb0462e7b393a38275f4de682e02..8a899213c5bc083f6333078704b89819b8172f7d 100644 (file)
@@ -78,7 +78,19 @@ CHECK_CXX_SOURCE_COMPILES(
 RESET_CMAKE_REQUIRED()
 
 #
-# Manually assemble some version information:
+# Newer versions of FindMPI.cmake only populate MPI_CXX_* (and MPI_C_*,
+# MPI_Fortran_*) variables. Let's rename these version names
+#
+
+IF(NOT DEFINED MPI_VERSION AND DEFINED MPI_CXX_VERSION)
+  SET(MPI_VERSION ${MPI_CXX_VERSION})
+  SET(MPI_VERSION_MAJOR ${MPI_CXX_VERSION_MAJOR})
+  SET(MPI_VERSION_MINOR ${MPI_CXX_VERSION_MINOR})
+ENDIF()
+
+#
+# Really old versions of CMake do not export any version information. In
+# this case, query the mpi.h header for the necessary information:
 #
 
 DEAL_II_FIND_FILE(MPI_MPI_H
@@ -97,11 +109,6 @@ IF(NOT MPI_MPI_H MATCHES "-NOTFOUND" AND NOT DEFINED MPI_VERSION)
     MPI_VERSION_MINOR "${MPI_VERSION_MINOR_STRING}"
     )
   SET(MPI_VERSION "${MPI_VERSION_MAJOR}.${MPI_VERSION_MINOR}")
-  IF("${MPI_VERSION}" STREQUAL ".")
-    SET(MPI_VERSION)
-    SET(MPI_VERSION_MAJOR)
-    SET(MPI_VERSION_MINOR)
-  ENDIF()
 ENDIF()
 
 DEAL_II_PACKAGE_HANDLE(MPI

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.