summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-04-23 13:50:02 (GMT)
committerBrad King <brad.king@kitware.com>2010-04-23 13:50:02 (GMT)
commit378acb1d4d280bdfba45d8c524e55e4b6714255d (patch)
tree82c23b6359d9ce8f77bd08d00114ffb9662829cb /Source
parent5bfffd6f295678aedd53a53da77e0eaaafc21140 (diff)
downloadCMake-378acb1d4d280bdfba45d8c524e55e4b6714255d.zip
CMake-378acb1d4d280bdfba45d8c524e55e4b6714255d.tar.gz
CMake-378acb1d4d280bdfba45d8c524e55e4b6714255d.tar.bz2
Teach cmake_minimum_required about tweak version
The command now accepts four version components in the format major[.minor[.patch[.tweak]]] This corresponds to the new versioning scheme introduced recently.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCMakeMinimumRequired.cxx19
-rw-r--r--Source/cmCMakeMinimumRequired.h4
2 files changed, 15 insertions, 8 deletions
diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx
index b7e939e..126934c 100644
--- a/Source/cmCMakeMinimumRequired.cxx
+++ b/Source/cmCMakeMinimumRequired.cxx
@@ -66,14 +66,17 @@ bool cmCMakeMinimumRequired
int current_major = cmVersion::GetMajorVersion();
int current_minor = cmVersion::GetMinorVersion();
int current_patch = cmVersion::GetPatchVersion();
+ int current_tweak = cmVersion::GetTweakVersion();
- // Parse the required version number. If no patch-level is given
- // use zero.
+ // Parse at least two components of the version number.
+ // Use zero for those not specified.
int required_major = 0;
int required_minor = 0;
int required_patch = 0;
- if(sscanf(version_string.c_str(), "%d.%d.%d",
- &required_major, &required_minor, &required_patch) < 2)
+ int required_tweak = 0;
+ if(sscanf(version_string.c_str(), "%u.%u.%u.%u",
+ &required_major, &required_minor,
+ &required_patch, &required_tweak) < 2)
{
cmOStringStream e;
e << "could not parse VERSION \"" << version_string.c_str() << "\".";
@@ -87,13 +90,17 @@ bool cmCMakeMinimumRequired
current_minor < required_minor) ||
(current_major == required_major &&
current_minor == required_minor &&
- current_patch < required_patch))
+ current_patch < required_patch) ||
+ (current_major == required_major &&
+ current_minor == required_minor &&
+ current_patch == required_patch &&
+ current_tweak < required_tweak))
{
// The current version is too low.
cmOStringStream e;
e << "CMake " << version_string.c_str()
<< " or higher is required. You are running version "
- << current_major << "." << current_minor << "." << current_patch;
+ << cmVersion::GetCMakeVersion();
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
cmSystemTools::SetFatalErrorOccured();
return true;
diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h
index 05c2505..9bf7ef8 100644
--- a/Source/cmCMakeMinimumRequired.h
+++ b/Source/cmCMakeMinimumRequired.h
@@ -61,13 +61,13 @@ public:
virtual const char* GetFullDocumentation()
{
return
- " cmake_minimum_required(VERSION major[.minor[.patch]]\n"
+ " cmake_minimum_required(VERSION major[.minor[.patch[.tweak]]]\n"
" [FATAL_ERROR])\n"
"If the current version of CMake is lower than that required "
"it will stop processing the project and report an error. "
"When a version higher than 2.4 is specified the command implicitly "
"invokes\n"
- " cmake_policy(VERSION major[.minor[.patch]])\n"
+ " cmake_policy(VERSION major[.minor[.patch[.tweak]]])\n"
"which sets the cmake policy version level to the version specified. "
"When version 2.4 or lower is given the command implicitly invokes\n"
" cmake_policy(VERSION 2.4)\n"