summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2005-06-17 13:49:06 (GMT)
committerBrad King <brad.king@kitware.com>2005-06-17 13:49:06 (GMT)
commit65e2c18d736f00cccafd6d13f9dcb3b42e2ce969 (patch)
tree9f86e7a33ea9bc22bf29634e16ab146eeda3ee0e
parent6c1a83609e16d13a110b39dd6078275236040699 (diff)
downloadCMake-65e2c18d736f00cccafd6d13f9dcb3b42e2ce969.zip
CMake-65e2c18d736f00cccafd6d13f9dcb3b42e2ce969.tar.gz
CMake-65e2c18d736f00cccafd6d13f9dcb3b42e2ce969.tar.bz2
ENH: Enabling ability for CMAKE_MINIMUM_REQUIRED version to include patch level. Submitted by Alexander Neundorf.
-rw-r--r--Source/cmCMakeMinimumRequired.cxx12
-rw-r--r--Source/cmMakefile.h1
-rw-r--r--Source/cmVersion.h1
3 files changed, 13 insertions, 1 deletions
diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx
index 9a96093..e618c1b 100644
--- a/Source/cmCMakeMinimumRequired.cxx
+++ b/Source/cmCMakeMinimumRequired.cxx
@@ -30,8 +30,18 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector<std::string> const& args)
}
float version = float(m_Makefile->GetMajorVersion());
version += (float(m_Makefile->GetMinorVersion()) * (float).1);
+ version += (float(m_Makefile->GetPatchVersion()) * (float).01);
float reqVersion = 0;
- sscanf(args[1].c_str(), "%f", &reqVersion);
+ int major=0;
+ int minor=0;
+ int patch=0;
+
+ int res=sscanf(args[1].c_str(), "%d.%d.%d", &major, &minor, &patch);
+ if (res==3)
+ reqVersion=float(major)+0.1*float(minor)+0.01*float(patch);
+ else if (res==2)
+ reqVersion=float(major)+0.1*float(minor);
+
if(reqVersion > version)
{
cmOStringStream str;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 5d00c93..e8b159c 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -50,6 +50,7 @@ public:
*/
static unsigned int GetMajorVersion() { return CMake_VERSION_MAJOR; }
static unsigned int GetMinorVersion() { return CMake_VERSION_MINOR; }
+ static unsigned int GetPatchVersion() { return CMake_VERSION_PATCH; }
static const char* GetReleaseVersion();
/**
diff --git a/Source/cmVersion.h b/Source/cmVersion.h
index 92ed988..29eb9d1 100644
--- a/Source/cmVersion.h
+++ b/Source/cmVersion.h
@@ -32,6 +32,7 @@ public:
*/
static unsigned int GetMajorVersion() { return CMake_VERSION_MAJOR; }
static unsigned int GetMinorVersion() { return CMake_VERSION_MINOR; }
+ static unsigned int GetPatchVersion() { return CMake_VERSION_PATCH; }
static std::string GetReleaseVersion();
static std::string GetCMakeVersion();
};