Skip to content

Commit

Permalink
Add missing defines to version.h to ease usage w/o the need for linki…
Browse files Browse the repository at this point in the history
…ng (#555)
  • Loading branch information
tribal-tec authored Jun 6, 2017
1 parent 0e90645 commit 7ab5af2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
9 changes: 2 additions & 7 deletions cpp/version.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// generated by CommonLibrary.cmake, do not edit.

#include <@INCLUDE_NAME@/version.h>
#include <sstream>

namespace @namespace@
{
Expand All @@ -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()
Expand All @@ -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;
}

}
8 changes: 8 additions & 0 deletions cpp/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) || \
Expand Down

0 comments on commit 7ab5af2

Please sign in to comment.