From 2841f23c785be8945252edf70c667638c83e96ba Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Mon, 22 Dec 2014 16:38:08 -0500 Subject: [PATCH] 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. --- cmake/modules/FindMUPARSER.cmake | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) 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}" ) -- 2.39.5