diff options
author | Brad King <brad.king@kitware.com> | 2008-03-05 22:26:32 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-03-05 22:26:32 (GMT) |
commit | 95512a4c0230986c52951102909dac00dcfe4bf4 (patch) | |
tree | f7ca9af122296a7d0799327b1a076a76ea298772 /Source/cmPolicies.cxx | |
parent | 2a06c660bff2b681992ac8e45840a248550e11b5 (diff) | |
download | CMake-95512a4c0230986c52951102909dac00dcfe4bf4.zip CMake-95512a4c0230986c52951102909dac00dcfe4bf4.tar.gz CMake-95512a4c0230986c52951102909dac00dcfe4bf4.tar.bz2 |
BUG: Fix parsing of policy version number in cmPolicies.
Diffstat (limited to 'Source/cmPolicies.cxx')
-rw-r--r-- | Source/cmPolicies.cxx | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 77d903f..a60fc1c 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -175,25 +175,10 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, unsigned int majorVer = 2; unsigned int minorVer = 0; unsigned int patchVer = 0; - + // parse the string - std::string major = ver.substr(0,ver.find('.')); - std::string patch = ver.substr(ver.find('.')); - std::string minor = patch.substr(0,patch.find('.')); - patch = patch.substr(patch.find('.')); - - if (major.size()) - { - majorVer = atoi(major.c_str()); - } - if (minor.size()) - { - minorVer = atoi(minor.c_str()); - } - if (patch.size()) - { - patchVer = atoi(patch.c_str()); - } + sscanf(ver.c_str(), "%u.%u.%u", + &majorVer, &minorVer, &patchVer); // add in the old CMAKE_BACKWARDS_COMPATIBILITY var for old CMake compatibility if ((majorVer == 2 && minorVer <= 4) || majorVer < 2) |