diff options
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 96de6ad..bf928fc 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -111,6 +111,8 @@ cmFindPackageCommand::cmFindPackageCommand() this->SortOrder = None; this->SortDirection = Asc; this->AppendSearchPathGroups(); + + this->DeprecatedFindModules["Qt"] = cmPolicies::CMP0084; } void cmFindPackageCommand::AppendSearchPathGroups() @@ -653,8 +655,31 @@ bool cmFindPackageCommand::FindModule(bool& found) std::string module = "Find"; module += this->Name; module += ".cmake"; - std::string mfile = this->Makefile->GetModulesFile(module.c_str()); + bool system = false; + std::string mfile = this->Makefile->GetModulesFile(module.c_str(), system); if (!mfile.empty()) { + if (system) { + auto it = this->DeprecatedFindModules.find(this->Name); + if (it != this->DeprecatedFindModules.end()) { + cmPolicies::PolicyStatus status = + this->Makefile->GetPolicyStatus(it->second); + switch (status) { + case cmPolicies::WARN: { + std::ostringstream e; + e << cmPolicies::GetPolicyWarning(it->second) << "\n"; + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + CM_FALLTHROUGH; + } + case cmPolicies::OLD: + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + return true; + } + } + } + // Load the module we found, and set "<name>_FIND_MODULE" to true // while inside it. found = true; @@ -1429,7 +1454,7 @@ void cmFindPackageCommand::FillPrefixesUserHints() bool cmFindPackageCommand::SearchDirectory(std::string const& dir) { - assert(!dir.empty() && dir[dir.size() - 1] == '/'); + assert(!dir.empty() && dir.back() == '/'); // Check each path suffix on this directory. for (std::string const& s : this->SearchPathSuffixes) { @@ -1447,7 +1472,7 @@ bool cmFindPackageCommand::SearchDirectory(std::string const& dir) bool cmFindPackageCommand::CheckDirectory(std::string const& dir) { - assert(!dir.empty() && dir[dir.size() - 1] == '/'); + assert(!dir.empty() && dir.back() == '/'); // Look for the file in this directory. std::string d = dir.substr(0, dir.size() - 1); @@ -2001,7 +2026,7 @@ private: bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) { - assert(!prefix_in.empty() && prefix_in[prefix_in.size() - 1] == '/'); + assert(!prefix_in.empty() && prefix_in.back() == '/'); if (this->DebugMode) { fprintf(stderr, "Checking prefix [%s]\n", prefix_in.c_str()); } @@ -2157,7 +2182,7 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) bool cmFindPackageCommand::SearchFrameworkPrefix(std::string const& prefix_in) { - assert(!prefix_in.empty() && prefix_in[prefix_in.size() - 1] == '/'); + assert(!prefix_in.empty() && prefix_in.back() == '/'); if (this->DebugMode) { fprintf(stderr, "Checking framework prefix [%s]\n", prefix_in.c_str()); } @@ -2218,7 +2243,7 @@ bool cmFindPackageCommand::SearchFrameworkPrefix(std::string const& prefix_in) bool cmFindPackageCommand::SearchAppBundlePrefix(std::string const& prefix_in) { - assert(!prefix_in.empty() && prefix_in[prefix_in.size() - 1] == '/'); + assert(!prefix_in.empty() && prefix_in.back() == '/'); if (this->DebugMode) { fprintf(stderr, "Checking bundle prefix [%s]\n", prefix_in.c_str()); } |