)
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}"
)