ENDIF()
ENDFOREACH()
+ #
+ # Manually assemble some version information:
+ #
+ IF(EXISTS ${MPI_INCLUDE_PATH}/mpi.h)
+ FILE(STRINGS "${MPI_INCLUDE_PATH}/mpi.h" MPI_VERSION_MAJOR_STRING
+ REGEX "#define.*MPI_VERSION")
+ STRING(REGEX REPLACE "^.*MPI_VERSION.*([0-9]+).*" "\\1"
+ MPI_VERSION_MAJOR "${MPI_VERSION_MAJOR_STRING}"
+ )
+ FILE(STRINGS "${MPI_INCLUDE_PATH}/mpi.h" MPI_VERSION_MINOR_STRING
+ REGEX "#define.*MPI_SUBVERSION")
+ STRING(REGEX REPLACE "^.*MPI_SUBVERSION.*([0-9]+).*" "\\1"
+ 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()
+
+ # OMPI specific version number:
+ FILE(STRINGS "${MPI_INCLUDE_PATH}/mpi.h" OMPI_VERSION_MAJOR_STRING
+ REGEX "#define.*OMPI_MAJOR_VERSION")
+ STRING(REGEX REPLACE "^.*OMPI_MAJOR_VERSION.*([0-9]+).*" "\\1"
+ OMPI_VERSION_MAJOR "${OMPI_VERSION_MAJOR_STRING}"
+ )
+ FILE(STRINGS "${MPI_INCLUDE_PATH}/mpi.h" OMPI_VERSION_MINOR_STRING
+ REGEX "#define.*OMPI_MINOR_VERSION")
+ STRING(REGEX REPLACE "^.*OMPI_MINOR_VERSION.*([0-9]+).*" "\\1"
+ OMPI_VERSION_MINOR "${OMPI_VERSION_MINOR_STRING}"
+ )
+ FILE(STRINGS "${MPI_INCLUDE_PATH}/mpi.h" OMPI_VERSION_RELEASE_STRING
+ REGEX "#define.*OMPI_RELEASE_VERSION")
+ STRING(REGEX REPLACE "^.*OMPI_RELEASE_VERSION.*([0-9]+).*" "\\1"
+ OMPI_VERSION_SUBMINOR "${OMPI_VERSION_RELEASE_STRING}"
+ )
+ SET(OMPI_VERSION
+ "${OMPI_VERSION_MAJOR}.${OMPI_VERSION_MINOR}.${OMPI_VERSION_SUBMINOR}"
+ )
+ IF("${OMPI_VERSION}" STREQUAL "..")
+ SET(OMPI_VERSION)
+ SET(OMPI_VERSION_MAJOR)
+ SET(OMPI_VERSION_MINOR)
+ SET(OMPI_VERSION_SUBMINOR)
+ ENDIF()
+
+ ENDIF()
+
+
# Hide some variables:
MARK_AS_ADVANCED(MPI_EXTRA_LIBRARY MPI_LIBRARY)
# SET(MPI_CXX_INCLUDE_PATH "include directory for mpi" CACHE STRING "")
# SET(MPI_CXX_COMPILE_FLAGS "..." CACHE STRING "")
# SET(MPI_CXX_LINK_FLAGS "..." CACHE STRING "")
+# SET(MPI_VERSION "x.y" CACHE STRING "")
+# SET(MPI_VERSION_MAJOR "x" CACHE STRING "")
+# SET(MPI_VERSION_MINOR "y" CACHE STRING "")
#
# Additionally:
#