summaryrefslogtreecommitdiffstats
path: root/Source/cmVersion.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-02-10 19:52:59 (GMT)
committerBrad King <brad.king@kitware.com>2014-02-10 20:32:32 (GMT)
commitd2059d25114b53c1e7531704b3e955c6853a355e (patch)
tree36e288b55188ca301d08da6694ed7cdbdf612050 /Source/cmVersion.h
parent28805109bcdea33933e889801a065fd1484b0547 (diff)
downloadCMake-d2059d25114b53c1e7531704b3e955c6853a355e.zip
CMake-d2059d25114b53c1e7531704b3e955c6853a355e.tar.gz
CMake-d2059d25114b53c1e7531704b3e955c6853a355e.tar.bz2
cmVersion: Fix CMake_VERSION_ENCODE for date in patch level
Use a uint64_t to store encoded version numbers so we have plenty of bits available. Encode with room for up to 1000 minor releases between major releases and to encode dates until the year 10000 in the patch level. This is necessary because CMake development versions prior to release 2.8.0 used the date in the patch level, and this practice may be restored after the 3.0 release.
Diffstat (limited to 'Source/cmVersion.h')
-rw-r--r--Source/cmVersion.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/Source/cmVersion.h b/Source/cmVersion.h
index e313524..0ab6390 100644
--- a/Source/cmVersion.h
+++ b/Source/cmVersion.h
@@ -32,8 +32,13 @@ public:
static const char* GetCMakeVersion();
};
+/* Encode with room for up to 1000 minor releases between major releases
+ and to encode dates until the year 10000 in the patch level. */
+#define CMake_VERSION_ENCODE__BASE cmIML_INT_UINT64_C(100000000)
#define CMake_VERSION_ENCODE(major, minor, patch) \
- ((major)*0x10000u + (minor)*0x100u + (patch))
+ ((((major) * 1000u) * CMake_VERSION_ENCODE__BASE) + \
+ (((minor) % 1000u) * CMake_VERSION_ENCODE__BASE) + \
+ (((patch) % CMake_VERSION_ENCODE__BASE)))
#endif