diff options
Diffstat (limited to 'Source/cmFindBase.cxx')
-rw-r--r-- | Source/cmFindBase.cxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 068dcfc..581c401 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -3,7 +3,9 @@ #include "cmFindBase.h" #include "cmConfigure.h" +#include <deque> #include <iostream> +#include <iterator> #include <map> #include <stddef.h> @@ -158,6 +160,9 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn) void cmFindBase::ExpandPaths() { if (!this->NoDefaultPath) { + if (!this->NoPackageRootPath) { + this->FillPackageRootPath(); + } if (!this->NoCMakePath) { this->FillCMakeVariablePath(); } @@ -196,6 +201,23 @@ void cmFindBase::FillCMakeEnvironmentPath() paths.AddSuffixes(this->SearchPathSuffixes); } +void cmFindBase::FillPackageRootPath() +{ + 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.AddCMakePrefixPath(varName); + paths.AddEnvPrefixPath(varName); + } +} + void cmFindBase::FillCMakeVariablePath() { cmSearchPath& paths = this->LabeledPaths[PathLabel::CMake]; |