From: Timo Heister Date: Thu, 30 Mar 2017 21:37:53 +0000 (-0400) Subject: fix cmake regex for finding MPI version X-Git-Tag: v8.5.0-rc2~9^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4164%2Fhead;p=dealii.git fix cmake regex for finding MPI version 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. --- diff --git a/cmake/modules/FindMPI.cmake b/cmake/modules/FindMPI.cmake index 7f1d396d64..1c74da93b2 100644 --- a/cmake/modules/FindMPI.cmake +++ b/cmake/modules/FindMPI.cmake @@ -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