summaryrefslogtreecommitdiffstats
path: root/Source/cmFindPackageCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r--Source/cmFindPackageCommand.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 51137b3..86251d2 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -426,7 +426,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
// fill various parts of version specification
if (!this->VersionComplete.empty()) {
if (!versionRegex.find(this->VersionComplete)) {
- this->SetError("called with invalid version specification");
+ this->SetError("called with invalid version specification.");
return false;
}
@@ -440,6 +440,19 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
}
}
+ if (!this->VersionRange.empty()) {
+ // version range must not be empty
+ if ((this->VersionRangeMax == VERSION_ENDPOINT_INCLUDED &&
+ cmSystemTools::VersionCompareGreater(this->Version,
+ this->VersionMax)) ||
+ (this->VersionRangeMax == VERSION_ENDPOINT_EXCLUDED &&
+ cmSystemTools::VersionCompareGreaterEq(this->Version,
+ this->VersionMax))) {
+ this->SetError("specified version range is empty.");
+ return false;
+ }
+ }
+
if (this->VersionExact && !this->VersionRange.empty()) {
this->SetError("EXACT cannot be specified with a version range.");
return false;