]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fix cmake muparser version string parsing
authorTimo Heister <timo.heister@gmail.com>
Mon, 22 Dec 2014 21:38:08 +0000 (16:38 -0500)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Tue, 23 Dec 2014 13:20:15 +0000 (14:20 +0100)
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

index fa7b9bbf4c285266420eaef44ab11311ddd7c130..22991f625317f977ee8573f3ec1d50b700b03e99 100644 (file)
@@ -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}"
     )

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.