find_package: mention requested version number in error message
When neither a Find-module or a config file can be found print the required version so the user knows which version of the package to install.
This commit is contained in:
parent
9c39bbd474
commit
6d8308314a
|
@ -962,6 +962,14 @@ bool cmFindPackageCommand::HandlePackageMode()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
std::string requestedVersionString;
|
||||||
|
if(!this->Version.empty())
|
||||||
|
{
|
||||||
|
requestedVersionString = " (requested version ";
|
||||||
|
requestedVersionString += this->Version;
|
||||||
|
requestedVersionString += ")";
|
||||||
|
}
|
||||||
|
|
||||||
if (this->UseConfigFiles)
|
if (this->UseConfigFiles)
|
||||||
{
|
{
|
||||||
if(this->UseFindModules)
|
if(this->UseFindModules)
|
||||||
|
@ -976,12 +984,13 @@ bool cmFindPackageCommand::HandlePackageMode()
|
||||||
{
|
{
|
||||||
e << "Could not find a package configuration file named \""
|
e << "Could not find a package configuration file named \""
|
||||||
<< this->Configs[0] << "\" provided by package \""
|
<< this->Configs[0] << "\" provided by package \""
|
||||||
<< this->Name << "\".\n";
|
<< this->Name << "\"" << requestedVersionString <<".\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
e << "Could not find a package configuration file provided by \""
|
e << "Could not find a package configuration file provided by \""
|
||||||
<< this->Name << "\" with any of the following names:\n";
|
<< this->Name << "\"" << requestedVersionString
|
||||||
|
<< " with any of the following names:\n";
|
||||||
for(std::vector<std::string>::const_iterator ci =
|
for(std::vector<std::string>::const_iterator ci =
|
||||||
this->Configs.begin();
|
this->Configs.begin();
|
||||||
ci != this->Configs.end(); ++ci)
|
ci != this->Configs.end(); ++ci)
|
||||||
|
|
Loading…
Reference in New Issue