From: Timo Heister Date: Mon, 22 Dec 2014 21:38:08 +0000 (-0500) Subject: fix cmake muparser version string parsing X-Git-Tag: v8.2.0-rc1~3^2~10 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b52cd00f776180cfbafcf7037e6aa0e5890ecada;p=dealii.git fix cmake muparser version string parsing Turns out there are muparser versions out there that don't have a subminor version which made our cmake code barf. --- diff --git a/cmake/modules/FindMUPARSER.cmake b/cmake/modules/FindMUPARSER.cmake index fa7b9bbf4c..22991f6253 100644 --- a/cmake/modules/FindMUPARSER.cmake +++ b/cmake/modules/FindMUPARSER.cmake @@ -41,18 +41,24 @@ DEAL_II_FIND_PATH(MUPARSER_INCLUDE_DIR muParserDef.h ) IF(EXISTS ${MUPARSER_INCLUDE_DIR}/muParserDef.h) - FILE(STRINGS "${MUPARSER_INCLUDE_DIR}/muParserDef.h" MUPARSER_VERSION_STRING + FILE(STRINGS "${MUPARSER_INCLUDE_DIR}/muParserDef.h" MUPARSER_VERSION_STRING_LINE REGEX "#define MUP_VERSION _T" ) - STRING(REGEX REPLACE ".*\"([0-9]+)\\.[0-9]+\\..*" "\\1" - MUPARSER_VERSION_MAJOR "${MUPARSER_VERSION_STRING}" - ) - STRING(REGEX REPLACE ".*\\.([0-9]+)\\..*" "\\1" - MUPARSER_VERSION_MINOR "${MUPARSER_VERSION_STRING}" - ) - STRING(REGEX REPLACE ".*\\.[0-9]+\\.([0-9]+)\".*" "\\1" - MUPARSER_VERSION_SUBMINOR "${MUPARSER_VERSION_STRING}" + + STRING(REGEX REPLACE ".*\"(.*)\".*" "\\1" + _VERSION_STRING "${MUPARSER_VERSION_STRING_LINE}" ) + + STRING(REPLACE "." ";" _VERSION_LIST ${_VERSION_STRING}) + LIST(GET _VERSION_LIST 0 MUPARSER_VERSION_MAJOR) + LIST(GET _VERSION_LIST 1 MUPARSER_VERSION_MINOR) + LIST( LENGTH _VERSION_LIST _LISTLEN ) + IF (${_LISTLEN} GREATER 2) + LIST(GET _VERSION_LIST 2 MUPARSER_VERSION_SUBMINOR) + ELSE() + SET(MUPARSER_VERSION_SUBMINOR "0") + ENDIF() + SET(MUPARSER_VERSION "${MUPARSER_VERSION_MAJOR}.${MUPARSER_VERSION_MINOR}.${MUPARSER_VERSION_SUBMINOR}" )