ENH: Implemented QUIET argument propagation to FOO_FIND_QUIETLY setting in FindFOO.cmake module that is found.

This commit is contained in:
Brad King 2003-07-24 11:32:41 -04:00
parent 185c82b6ad
commit 78367fbc1b
2 changed files with 14 additions and 3 deletions

View File

@ -55,7 +55,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
// See if there is a Find<name>.cmake module. // See if there is a Find<name>.cmake module.
bool foundModule = false; bool foundModule = false;
if(!this->FindModule(foundModule)) if(!this->FindModule(foundModule, quiet))
{ {
return false; return false;
} }
@ -124,7 +124,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmFindPackageCommand::FindModule(bool& found) bool cmFindPackageCommand::FindModule(bool& found, bool quiet)
{ {
// Search the CMAKE_MODULE_PATH for a Find<name>.cmake module. // Search the CMAKE_MODULE_PATH for a Find<name>.cmake module.
found = false; found = false;
@ -157,6 +157,17 @@ bool cmFindPackageCommand::FindModule(bool& found)
if(cmSystemTools::FileExists(module.c_str())) if(cmSystemTools::FileExists(module.c_str()))
{ {
found = true; found = true;
if(quiet)
{
// Tell the module that is about to be read that it should find
// quietly.
std::string quietly = this->Name;
quietly += "_FIND_QUIETLY";
m_Makefile->AddDefinition(quietly.c_str(), "1");
}
// Load the module we found.
return this->ReadListFile(module.c_str()); return this->ReadListFile(module.c_str());
} }
} }

View File

@ -86,7 +86,7 @@ public:
cmTypeMacro(cmFindPackageCommand, cmCommand); cmTypeMacro(cmFindPackageCommand, cmCommand);
private: private:
bool FindModule(bool& found); bool FindModule(bool& found, bool quiet);
bool FindConfig(); bool FindConfig();
std::string SearchForConfig() const; std::string SearchForConfig() const;
bool ReadListFile(const char* f); bool ReadListFile(const char* f);