Commit 6f52ed1c authored by Brad King's avatar Brad King

ENH: Added creation of XXX_FIND_COMPONENTS list of all components requested...

ENH: Added creation of XXX_FIND_COMPONENTS list of all components requested with REQUIRED option.  This addresses the feature request in bug#3494.
parent 981787c9
......@@ -56,6 +56,9 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
this->Name = args[0];
// Build a list of required components.
std::string components;
const char* components_sep = "";
bool quiet = false;
bool required = false;
if(args.size() > 1)
......@@ -74,11 +77,32 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
}
else if(args[i] == "REQUIRED")
{
// The package is required.
required = true;
while (++i < args.size() && args[i] != "QUIET")
// Look for a list of required components.
while(++i < args.size())
{
std::string req_var = Name + "_FIND_REQUIRED_" + args[i];
this->Makefile->AddDefinition(req_var.c_str(), "1");
// Stop looking when a known keyword argument is
// encountered.
if((args[i] == "QUIET") ||
(args[i] == "REQUIRED"))
{
--i;
break;
}
else
{
// Set a variable telling the find script this component
// is required.
std::string req_var = Name + "_FIND_REQUIRED_" + args[i];
this->Makefile->AddDefinition(req_var.c_str(), "1");
// Append to the list of required components.
components += components_sep;
components += args[i];
components_sep = ";";
}
}
}
else
......@@ -89,6 +113,10 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
return false;
}
}
// Store the list of components.
std::string components_var = Name + "_FIND_COMPONENTS";
this->Makefile->AddDefinition(components_var.c_str(), components.c_str());
}
// See if there is a Find<name>.cmake module.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment