1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

find_package: Add missing PACKAGE_ROOT_PATH search path implementation.

This commit is contained in:
Chuck Atkins
2017-07-17 09:43:16 -04:00
parent f15cfd891d
commit c5d2b99c02
2 changed files with 21 additions and 0 deletions

View File

@@ -1090,6 +1090,9 @@ void cmFindPackageCommand::AppendSuccessInformation()
void cmFindPackageCommand::ComputePrefixes()
{
if (!this->NoDefaultPath) {
if (!this->NoPackageRootPath) {
this->FillPrefixesPackageRoot();
}
if (!this->NoCMakePath) {
this->FillPrefixesCMakeVariable();
}
@@ -1117,6 +1120,23 @@ void cmFindPackageCommand::ComputePrefixes()
this->ComputeFinalPaths();
}
void cmFindPackageCommand::FillPrefixesPackageRoot()
{
cmSearchPath& paths = this->LabeledPaths[PathLabel::PackageRoot];
// Add package specific search prefixes
// NOTE: This should be using const_reverse_iterator but HP aCC and
// Oracle sunCC both currently have standard library issues
// with the reverse iterator APIs.
for (std::deque<std::string>::reverse_iterator pkg =
this->Makefile->FindPackageModuleStack.rbegin();
pkg != this->Makefile->FindPackageModuleStack.rend(); ++pkg) {
std::string varName = *pkg + "_ROOT";
paths.AddCMakePath(varName);
paths.AddEnvPath(varName);
}
}
void cmFindPackageCommand::FillPrefixesCMakeEnvironment()
{
cmSearchPath& paths = this->LabeledPaths[PathLabel::CMakeEnvironment];

View File

@@ -100,6 +100,7 @@ private:
void StoreVersionFound();
void ComputePrefixes();
void FillPrefixesPackageRoot();
void FillPrefixesCMakeEnvironment();
void FillPrefixesCMakeVariable();
void FillPrefixesSystemEnvironment();