Commit 7ea84478 authored by Guillaume Pasero's avatar Guillaume Pasero

ENH: parse version for muParser

parent 7665d889
......@@ -4,6 +4,11 @@
# MUPARSER_FOUND - True if MuParser found.
# MUPARSER_INCLUDE_DIRS - where to find muParser.h, etc.
# MUPARSER_LIBRARIES - List of libraries when using MuParser.
# MUPARSER_VERSION - version string
# MUPARSER_VERSION_MAJOR - version major number
# MUPARSER_VERSION_MINOR - version minor number
# MUPARSER_VERSION_PATCH - version patch number
# MUPARSER_VERSION_NUMBER - version number ((major*100)+minor)*100+patch
#
if( MUPARSER_INCLUDE_DIR )
......@@ -14,6 +19,20 @@ endif()
find_path( MUPARSER_INCLUDE_DIR muParser.h
PATH_SUFFIXES muParser )
if(EXISTS "${MUPARSER_INCLUDE_DIR}/muParserDef.h")
file(READ "${MUPARSER_INCLUDE_DIR}/muParserDef.h" _muParserDef_h_CONTENTS)
string(REGEX REPLACE ".*# *define MUP_VERSION *_T\\(\"([0-9.]+)\"\\).*" "\\1" MUPARSER_VERSION "${_muParserDef_h_CONTENTS}")
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" MUPARSER_VERSION_MAJOR "${MUPARSER_VERSION}")
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" MUPARSER_VERSION_MINOR "${MUPARSER_VERSION}")
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\3" MUPARSER_VERSION_PATCH "${MUPARSER_VERSION}")
math(EXPR MUPARSER_VERSION_NUMBER
"((${MUPARSER_VERSION_MAJOR})*100+${MUPARSER_VERSION_MINOR})*100+${MUPARSER_VERSION_PATCH}")
else()
if(NOT MuParser_FIND_QUIETLY)
message(WARNING "muParserDef.h not found !")
endif()
endif()
find_library( MUPARSER_LIBRARY
NAMES muparser
PATH_SUFFIXES muparser )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment