]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fix cmake regex for finding MPI version 4164/head
authorTimo Heister <timo.heister@gmail.com>
Thu, 30 Mar 2017 21:37:53 +0000 (17:37 -0400)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Fri, 31 Mar 2017 09:31:17 +0000 (11:31 +0200)
cmake regex is greedy, which means that the old regex
MPI_VERSION.*([0-9]+)
would only put the last digit of the version into the group \1 because
.* consumes the others. Fix this.

cmake/modules/FindMPI.cmake

index 7f1d396d6489b131c1daa8903a10a3381c2342a0..1c74da93b2a48e82d0e654672e1132753a070ae9 100644 (file)
@@ -129,12 +129,12 @@ DEAL_II_FIND_FILE(MPI_MPI_H
 IF(NOT MPI_MPI_H MATCHES "-NOTFOUND" AND NOT DEFINED MPI_VERSION)
   FILE(STRINGS "${MPI_MPI_H}" MPI_VERSION_MAJOR_STRING
     REGEX "#define.*MPI_VERSION")
-  STRING(REGEX REPLACE "^.*MPI_VERSION.*([0-9]+).*" "\\1"
+  STRING(REGEX REPLACE "^.*MPI_VERSION[ ]+([0-9]+).*" "\\1"
     MPI_VERSION_MAJOR "${MPI_VERSION_MAJOR_STRING}"
     )
   FILE(STRINGS ${MPI_MPI_H} MPI_VERSION_MINOR_STRING
     REGEX "#define.*MPI_SUBVERSION")
-  STRING(REGEX REPLACE "^.*MPI_SUBVERSION.*([0-9]+).*" "\\1"
+  STRING(REGEX REPLACE "^.*MPI_SUBVERSION[ ]+([0-9]+).*" "\\1"
     MPI_VERSION_MINOR "${MPI_VERSION_MINOR_STRING}"
     )
   SET(MPI_VERSION "${MPI_VERSION_MAJOR}.${MPI_VERSION_MINOR}")
@@ -147,17 +147,17 @@ IF(NOT MPI_MPI_H MATCHES "-NOTFOUND" AND NOT DEFINED MPI_VERSION)
   # OMPI specific version number:
   FILE(STRINGS ${MPI_MPI_H} OMPI_VERSION_MAJOR_STRING
     REGEX "#define.*OMPI_MAJOR_VERSION")
-  STRING(REGEX REPLACE "^.*OMPI_MAJOR_VERSION.*([0-9]+).*" "\\1"
+  STRING(REGEX REPLACE "^.*OMPI_MAJOR_VERSION[ ]+([0-9]+).*" "\\1"
     OMPI_VERSION_MAJOR "${OMPI_VERSION_MAJOR_STRING}"
     )
   FILE(STRINGS ${MPI_MPI_H} OMPI_VERSION_MINOR_STRING
     REGEX "#define.*OMPI_MINOR_VERSION")
-  STRING(REGEX REPLACE "^.*OMPI_MINOR_VERSION.*([0-9]+).*" "\\1"
+  STRING(REGEX REPLACE "^.*OMPI_MINOR_VERSION[ ]+([0-9]+).*" "\\1"
     OMPI_VERSION_MINOR "${OMPI_VERSION_MINOR_STRING}"
     )
   FILE(STRINGS ${MPI_MPI_H} OMPI_VERSION_RELEASE_STRING
     REGEX "#define.*OMPI_RELEASE_VERSION")
-  STRING(REGEX REPLACE "^.*OMPI_RELEASE_VERSION.*([0-9]+).*" "\\1"
+  STRING(REGEX REPLACE "^.*OMPI_RELEASE_VERSION[ ]+([0-9]+).*" "\\1"
     OMPI_VERSION_SUBMINOR "${OMPI_VERSION_RELEASE_STRING}"
     )
   SET(OMPI_VERSION

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.