Merge topic 'cmake-devel-version-macro'

9bcc1b21 Export: Fix internal CMake version test logic
d2059d25 cmVersion: Fix CMake_VERSION_ENCODE for date in patch level
28805109 cmStandardIncludes: Include cmIML/INT.h for portable integer types
This commit is contained in:
Brad King 2014-02-11 09:16:09 -05:00 committed by CMake Topic Stage
commit 418a155be7
8 changed files with 36 additions and 11 deletions

View File

@ -930,7 +930,7 @@ bool cmCacheManager::NeedCacheCompatibility(int major, int minor)
// Compatibility is needed if the cache version is equal to or lower // Compatibility is needed if the cache version is equal to or lower
// than the given version. // than the given version.
unsigned int actual_compat = cmIML_INT_uint64_t actual_compat =
CMake_VERSION_ENCODE(this->CacheMajorVersion, this->CacheMinorVersion, 0); CMake_VERSION_ENCODE(this->CacheMajorVersion, this->CacheMinorVersion, 0);
return (actual_compat && return (actual_compat &&
actual_compat <= CMake_VERSION_ENCODE(major, minor, 0)); actual_compat <= CMake_VERSION_ENCODE(major, minor, 0));

View File

@ -19,15 +19,17 @@
#include "cmInstallExportGenerator.h" #include "cmInstallExportGenerator.h"
#include "cmInstallTargetGenerator.h" #include "cmInstallTargetGenerator.h"
#include "cmTargetExport.h" #include "cmTargetExport.h"
#include "cmVersionConfig.h" #include "cmVersionMacros.h"
#include "cmVersion.h"
#define STRINGIFY_HELPER(X) #X #define STRINGIFY_HELPER(X) #X
#define STRINGIFY(X) STRINGIFY_HELPER(X) #define STRINGIFY(X) STRINGIFY_HELPER(X)
#define DEVEL_CMAKE_VERSION(maj, min, patch) \ #define DEVEL_CMAKE_VERSION(maj, min, patch) \
(maj > CMake_VERSION_MAJOR \ (CMake_VERSION_ENCODE(maj, min, patch) > \
|| min > CMake_VERSION_MINOR \ CMake_VERSION_ENCODE(CMake_VERSION_MAJOR, CMake_VERSION_MINOR, \
|| patch > CMake_VERSION_PATCH) ? \ CMake_VERSION_PATCH) \
) ? \
STRINGIFY(CMake_VERSION_MAJOR) "." STRINGIFY(CMake_VERSION_MINOR) "." \ STRINGIFY(CMake_VERSION_MAJOR) "." STRINGIFY(CMake_VERSION_MINOR) "." \
STRINGIFY(CMake_VERSION_PATCH) "." STRINGIFY(CMake_VERSION_TWEAK) \ STRINGIFY(CMake_VERSION_PATCH) "." STRINGIFY(CMake_VERSION_TWEAK) \
: #maj "." #min "." #patch : #maj "." #min "." #patch

View File

@ -114,7 +114,7 @@ private:
unsigned int VersionFoundPatch; unsigned int VersionFoundPatch;
unsigned int VersionFoundTweak; unsigned int VersionFoundTweak;
unsigned int VersionFoundCount; unsigned int VersionFoundCount;
unsigned int RequiredCMakeVersion; cmIML_INT_uint64_t RequiredCMakeVersion;
bool Quiet; bool Quiet;
bool Required; bool Required;
bool UseConfigFiles; bool UseConfigFiles;

View File

@ -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 // The computed version may change until the project is fully
// configured. // configured.
@ -3398,7 +3398,7 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4()
// Compatibility is needed if CMAKE_BACKWARDS_COMPATIBILITY is set // Compatibility is needed if CMAKE_BACKWARDS_COMPATIBILITY is set
// equal to or lower than the given version. // 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 && return (actual_compat &&
actual_compat <= CMake_VERSION_ENCODE(2, 4, 255)); actual_compat <= CMake_VERSION_ENCODE(2, 4, 255));
} }

View File

@ -321,7 +321,7 @@ public:
* *
* and is monotonically increasing with the CMake version. * 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. * Test whether compatibility is set to a given version or lower.
@ -460,7 +460,7 @@ protected:
bool RelativePathsConfigured; bool RelativePathsConfigured;
bool PathConversionsSetup; bool PathConversionsSetup;
unsigned int BackwardsCompatibility; cmIML_INT_uint64_t BackwardsCompatibility;
bool BackwardsCompatibilityFinal; bool BackwardsCompatibilityFinal;
private: private:
std::string ConvertToOutputForExistingCommon(const char* remote, std::string ConvertToOutputForExistingCommon(const char* remote,

View File

@ -40,6 +40,9 @@
#pragma warning ( disable : 1572 ) /* floating-point equality test */ #pragma warning ( disable : 1572 ) /* floating-point equality test */
#endif #endif
// Provide fixed-size integer types.
#include <cmIML/INT.h>
#include <stdarg.h> // Work-around for SGI MIPSpro 7.4.2m header bug #include <stdarg.h> // Work-around for SGI MIPSpro 7.4.2m header bug
// This is a hack to prevent warnings about these functions being // This is a hack to prevent warnings about these functions being

View File

@ -32,8 +32,13 @@ public:
static const char* GetCMakeVersion(); 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) \ #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 #endif

View File

@ -357,6 +357,11 @@ KWSYS_IOS_FILES="
iostream \ iostream \
sstream" sstream"
KWIML_FILES='
ABI.h
INT.h
'
# Display CMake bootstrap usage # Display CMake bootstrap usage
cmake_usage() cmake_usage()
{ {
@ -705,6 +710,11 @@ for a in stl ios; do
fi fi
done done
[ -d "cmIML" ] || mkdir "cmIML"
if [ ! -d "cmIML" ]; then
cmake_error 12 "Cannot create directory ${cmake_bootstrap_dir}/cmIML"
fi
# Delete all the bootstrap files # Delete all the bootstrap files
rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log" rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log"
rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}" rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}"
@ -1500,6 +1510,11 @@ for a in string vector set map algorithm; do
"${cmake_bootstrap_dir}/cmsys/stl/${a}" KWSYS_STL_HEADER ${a} "${cmake_bootstrap_dir}/cmsys/stl/${a}" KWSYS_STL_HEADER ${a}
done done
for a in ${KWIML_FILES}; do
cmake_replace_string "${cmake_source_dir}/Utilities/KWIML/${a}.in" \
"${cmake_bootstrap_dir}/cmIML/${a}" KWIML cmIML
done
# Generate Makefile # Generate Makefile
dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h" dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
objs="" objs=""