From 7ab5af2c1d8763523dbf7b7438cc574a9f506cfb Mon Sep 17 00:00:00 2001 From: Daniel Nachbaur Date: Tue, 6 Jun 2017 15:34:08 +0200 Subject: [PATCH] Add missing defines to version.h to ease usage w/o the need for linking (#555) --- CHANGES.md | 5 +++++ cpp/version.cpp | 9 ++------- cpp/version.h | 8 ++++++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e0d17d7..d1fa144 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +# git master + +* [555](https://github.com/Eyescale/CMake/pull/555): + Add missing defines to version.h to ease usage w/o the need for linking + # 2017.05 (23-May-2017) * [551](https://github.com/Eyescale/CMake/pull/551): diff --git a/cpp/version.cpp b/cpp/version.cpp index 7082868..be1c15d 100644 --- a/cpp/version.cpp +++ b/cpp/version.cpp @@ -1,7 +1,6 @@ // generated by CommonLibrary.cmake, do not edit. #include <@INCLUDE_NAME@/version.h> -#include namespace @namespace@ { @@ -28,9 +27,7 @@ int Version::getABI() std::string Version::getString() { - std::ostringstream version; - version << getMajor() << '.' << getMinor() << '.' << getPatch(); - return version.str(); + return @NAMESPACE@_VERSION_STRING; } unsigned long long Version::getRevision() @@ -40,9 +37,7 @@ unsigned long long Version::getRevision() std::string Version::getRevString() { - std::ostringstream version; - version << getString() << '.' << std::hex << getRevision() << std::dec; - return version.str(); + return @NAMESPACE@_REV_STRING; } } diff --git a/cpp/version.h b/cpp/version.h index b97c9e3..d559e5f 100644 --- a/cpp/version.h +++ b/cpp/version.h @@ -28,6 +28,14 @@ namespace @namespace@ /** The current binary interface. */ # define @NAMESPACE@_VERSION_ABI @PROJECT_VERSION_ABI@ull + /** The current major.minor.version as a string. */ +# define @NAMESPACE@_VERSION_STRING \ + "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@" + + /** The current major.minor.version.revision as a string. */ +# define @NAMESPACE@_REV_STRING \ + "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.0x@GIT_REVISION@" + /** True if the current version is newer than the given one. */ # define @NAMESPACE@_VERSION_GT( MAJOR, MINOR, PATCH ) \ ( (@NAMESPACE@_VERSION_MAJOR>MAJOR) || \