summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmFindPackageCommand.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 5f106bc..554601d 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -607,6 +607,24 @@ bool cmFindPackageCommand
}
}
+ std::string disableFindPackageVar = "CMAKE_DISABLE_FIND_PACKAGE_";
+ disableFindPackageVar += this->Name;
+ if(this->Makefile->IsOn(disableFindPackageVar.c_str()))
+ {
+ if (this->Required)
+ {
+ cmOStringStream e;
+ e << "for module " << this->Name << " called with REQUIRED, but "
+ << disableFindPackageVar
+ << " is enabled. A REQUIRED package cannot be disabled.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ return true;
+ }
+
+
this->SetModuleVariables(components);
// See if there is a Find<package>.cmake module.