diff options
author | Brad King <brad.king@kitware.com> | 2017-08-03 19:05:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-08-03 19:05:30 (GMT) |
commit | 8fb12ce7a22ffe21cb9dfc20ffaf111d0897a34a (patch) | |
tree | d77640644c534014720cd09b52a22e4496451f7d /Source | |
parent | 9d09d1a9229e952e94d414ec8cd4313463f6d464 (diff) | |
parent | 4a207116908c20caba4969120b1148adff391348 (diff) | |
download | CMake-8fb12ce7a22ffe21cb9dfc20ffaf111d0897a34a.zip CMake-8fb12ce7a22ffe21cb9dfc20ffaf111d0897a34a.tar.gz CMake-8fb12ce7a22ffe21cb9dfc20ffaf111d0897a34a.tar.bz2 |
Merge branch 'add-package_root-to-find_package' into release-3.9
Merge-request: !1082
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 20 | ||||
-rw-r--r-- | Source/cmFindPackageCommand.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index f291f9d..ca47535 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -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]; diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 318b1dc..99b0059 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -100,6 +100,7 @@ private: void StoreVersionFound(); void ComputePrefixes(); + void FillPrefixesPackageRoot(); void FillPrefixesCMakeEnvironment(); void FillPrefixesCMakeVariable(); void FillPrefixesSystemEnvironment(); |