diff --git a/CMake/FindTinyXML.cmake b/CMake/FindTinyXML.cmake
index 66635ca0ea82f2409c93bc8f60984bc3213be5f3..3f6f6513cdf21b1f1496fc55a1666be4f55e8270 100644
--- a/CMake/FindTinyXML.cmake
+++ b/CMake/FindTinyXML.cmake
@@ -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 )