summaryrefslogtreecommitdiffstats
path: root/Source/cmFindPackageCommand.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2018-10-31 17:26:04 (GMT)
committerBrad King <brad.king@kitware.com>2018-11-14 20:05:06 (GMT)
commit0f5c1b404b0f9cbe652cf306e9dca0c25c70876f (patch)
tree3040a94e2f7f8f9e0de4a8bd13debbe665ea997a /Source/cmFindPackageCommand.cxx
parentddb967cca1a37501dcf3fbd6f64c2d3be1c0c82b (diff)
downloadCMake-0f5c1b404b0f9cbe652cf306e9dca0c25c70876f.zip
CMake-0f5c1b404b0f9cbe652cf306e9dca0c25c70876f.tar.gz
CMake-0f5c1b404b0f9cbe652cf306e9dca0c25c70876f.tar.bz2
find_package(): Add policy to remove the FindQt module
Removing FindQt.cmake gives Qt upstream a path forward to export its own QtConfig.cmake files which can be found by find_package() without having to explicitly specify CONFIG. Projects that still want to use Qt3/4 can call find_package(Qt[34]), include(FindQt), or add FindQt.cmake to their CMAKE_MODULE_PATH.
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r--Source/cmFindPackageCommand.cxx27
1 files changed, 26 insertions, 1 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 97c1d7d..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;