cmSystemTools: Add VersionCompareGreater helper

Wrap a call to VersionCompare with OP_GREATER in a signature suitable
for use with std::sort.
This commit is contained in:
Gilles Khouzam 2015-09-30 13:22:43 -07:00 committed by Brad King
parent b31ac171a4
commit 61c472a287
2 changed files with 10 additions and 0 deletions

View File

@ -2776,6 +2776,14 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
return op == cmSystemTools::OP_EQUAL; return op == cmSystemTools::OP_EQUAL;
} }
//----------------------------------------------------------------------------
bool cmSystemTools::VersionCompareGreater(std::string const& lhs,
std::string const& rhs)
{
return cmSystemTools::VersionCompare(
cmSystemTools::OP_GREATER, lhs.c_str(), rhs.c_str());
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg, bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
bool* removed) bool* removed)

View File

@ -294,6 +294,8 @@ public:
* Compare versions * Compare versions
*/ */
static bool VersionCompare(CompareOp op, const char* lhs, const char* rhs); static bool VersionCompare(CompareOp op, const char* lhs, const char* rhs);
static bool VersionCompareGreater(std::string const& lhs,
std::string const& rhs);
/** /**
* Determine the file type based on the extension * Determine the file type based on the extension