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.
This commit is contained in:
parent
28805109bc
commit
d2059d2511
|
@ -930,7 +930,7 @@ bool cmCacheManager::NeedCacheCompatibility(int major, int minor)
|
|||
|
||||
// Compatibility is needed if the cache version is equal to or lower
|
||||
// than the given version.
|
||||
unsigned int actual_compat =
|
||||
cmIML_INT_uint64_t actual_compat =
|
||||
CMake_VERSION_ENCODE(this->CacheMajorVersion, this->CacheMinorVersion, 0);
|
||||
return (actual_compat &&
|
||||
actual_compat <= CMake_VERSION_ENCODE(major, minor, 0));
|
||||
|
|
|
@ -114,7 +114,7 @@ private:
|
|||
unsigned int VersionFoundPatch;
|
||||
unsigned int VersionFoundTweak;
|
||||
unsigned int VersionFoundCount;
|
||||
unsigned int RequiredCMakeVersion;
|
||||
cmIML_INT_uint64_t RequiredCMakeVersion;
|
||||
bool Quiet;
|
||||
bool Required;
|
||||
bool UseConfigFiles;
|
||||
|
|
|
@ -3345,7 +3345,7 @@ cmLocalGenerator::GetTargetDirectory(cmTarget const&) const
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
unsigned int cmLocalGenerator::GetBackwardsCompatibility()
|
||||
cmIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility()
|
||||
{
|
||||
// The computed version may change until the project is fully
|
||||
// configured.
|
||||
|
@ -3398,7 +3398,7 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4()
|
|||
|
||||
// Compatibility is needed if CMAKE_BACKWARDS_COMPATIBILITY is set
|
||||
// equal to or lower than the given version.
|
||||
unsigned int actual_compat = this->GetBackwardsCompatibility();
|
||||
cmIML_INT_uint64_t actual_compat = this->GetBackwardsCompatibility();
|
||||
return (actual_compat &&
|
||||
actual_compat <= CMake_VERSION_ENCODE(2, 4, 255));
|
||||
}
|
||||
|
|
|
@ -321,7 +321,7 @@ public:
|
|||
*
|
||||
* and is monotonically increasing with the CMake version.
|
||||
*/
|
||||
unsigned int GetBackwardsCompatibility();
|
||||
cmIML_INT_uint64_t GetBackwardsCompatibility();
|
||||
|
||||
/**
|
||||
* Test whether compatibility is set to a given version or lower.
|
||||
|
@ -460,7 +460,7 @@ protected:
|
|||
bool RelativePathsConfigured;
|
||||
bool PathConversionsSetup;
|
||||
|
||||
unsigned int BackwardsCompatibility;
|
||||
cmIML_INT_uint64_t BackwardsCompatibility;
|
||||
bool BackwardsCompatibilityFinal;
|
||||
private:
|
||||
std::string ConvertToOutputForExistingCommon(const char* remote,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue