diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Version.cmake | 12 | ||||
-rw-r--r-- | src/Version.h.in | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/Version.cmake b/src/Version.cmake index 02cc9da..4dbd25a 100644 --- a/src/Version.cmake +++ b/src/Version.cmake @@ -46,3 +46,15 @@ else() # Generic development version. set(CastXML_VERSION "${CastXML_VERSION}-git") endif() + +if(CastXML_VERSION MATCHES "^([0-9]+)\\.([0-9]+)(\\.([0-9]+))?") + set(CastXML_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(CastXML_VERSION_MINOR "${CMAKE_MATCH_2}") + if(CMAKE_MATCH_4) + set(CastXML_VERSION_PATCH "${CMAKE_MATCH_4}") + else() + set(CastXML_VERSION_PATCH 0) + endif() +else() + message(FATAL_ERROR "Failed to extract version components from '${CastXML_VERSION}'") +endif() diff --git a/src/Version.h.in b/src/Version.h.in index cec693f..3290311 100644 --- a/src/Version.h.in +++ b/src/Version.h.in @@ -17,5 +17,8 @@ #define CASTXML_VERSION_H #define CASTXML_VERSION_STRING "@CastXML_VERSION@" +#define CASTXML_VERSION_MAJOR @CastXML_VERSION_MAJOR@ +#define CASTXML_VERSION_MINOR @CastXML_VERSION_MINOR@ +#define CASTXML_VERSION_PATCH @CastXML_VERSION_PATCH@ #endif // CASTXML_VERSION_H |