Commit 535d3ac5 authored by Guillaume Pasero's avatar Guillaume Pasero

ENH: TinyXML version parsing

parent 5fbe8c8c
......@@ -4,6 +4,11 @@
# TINYXML_FOUND - True if TinyXML found.
# TINYXML_INCLUDE_DIRS - where to find tinyxml.h, etc.
# TINYXML_LIBRARIES - List of libraries when using TinyXML.
# TINYXML_VERSION - version string
# TINYXML_VERSION_MAJOR - version major number
# TINYXML_VERSION_MINOR - version minor number
# TINYXML_VERSION_PATCH - version patch number
# TINYXML_VERSION_NUMBER - version number ((major*100)+minor)*100+patch
#
if( TINYXML_INCLUDE_DIR )
......@@ -14,6 +19,21 @@ endif()
find_path( TINYXML_INCLUDE_DIR tinyxml.h
PATH_SUFFIXES tinyxml )
if(EXISTS "${TINYXML_INCLUDE_DIR}/tinyxml.h")
file(READ "${TINYXML_INCLUDE_DIR}/tinyxml.h" _tinyxml_h_CONTENTS)
string(REGEX REPLACE ".*const +int +TIXML_MAJOR_VERSION += +([0-9]+);.*" "\\1" TINYXML_VERSION_MAJOR "${_tinyxml_h_CONTENTS}")
string(REGEX REPLACE ".*const +int +TIXML_MINOR_VERSION += +([0-9]+);.*" "\\1" TINYXML_VERSION_MINOR "${_tinyxml_h_CONTENTS}")
string(REGEX REPLACE ".*const +int +TIXML_PATCH_VERSION += +([0-9]+);.*" "\\1" TINYXML_VERSION_PATCH "${_tinyxml_h_CONTENTS}")
set(TINYXML_VERSION "${TINYXML_VERSION_MAJOR}.${TINYXML_VERSION_MINOR}.${TINYXML_VERSION_PATCH}")
math(EXPR TINYXML_VERSION_NUMBER
"((${TINYXML_VERSION_MAJOR})*100+${TINYXML_VERSION_MINOR})*100+${TINYXML_VERSION_PATCH}")
else()
if(NOT TINYXML_FIND_QUIETLY)
message(WARNING "tinyxml.h not found !")
endif()
endif()
find_library( TINYXML_LIBRARY
NAMES tinyxml
PATH_SUFFIXES tinyxml )
......
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