|
|
@@ -1597,41 +1597,17 @@ bool HandleFilesMode(std::vector<std::string> const& args,
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- cmPolicies::PolicyStatus policyStatus =
|
|
|
- helper.Makefile->GetPolicyStatus(cmPolicies::CMP0062);
|
|
|
-
|
|
|
cmGlobalGenerator* gg = helper.Makefile->GetGlobalGenerator();
|
|
|
for (std::string const& file : filesVector) {
|
|
|
if (gg->IsExportedTargetsFile(file)) {
|
|
|
- const char* modal = nullptr;
|
|
|
- std::ostringstream e;
|
|
|
- MessageType messageType = MessageType::AUTHOR_WARNING;
|
|
|
-
|
|
|
- switch (policyStatus) {
|
|
|
- case cmPolicies::WARN:
|
|
|
- e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0062) << "\n";
|
|
|
- modal = "should";
|
|
|
- CM_FALLTHROUGH;
|
|
|
- case cmPolicies::OLD:
|
|
|
- break;
|
|
|
- case cmPolicies::NEW:
|
|
|
- modal = "may";
|
|
|
- messageType = MessageType::FATAL_ERROR;
|
|
|
- break;
|
|
|
- }
|
|
|
- if (modal) {
|
|
|
- e << "The file\n " << file
|
|
|
- << "\nwas generated by the export() "
|
|
|
- "command. It "
|
|
|
- << modal
|
|
|
- << " not be installed with the "
|
|
|
- "install() command. Use the install(EXPORT) mechanism "
|
|
|
- "instead. See the cmake-packages(7) manual for more.\n";
|
|
|
- helper.Makefile->IssueMessage(messageType, e.str());
|
|
|
- if (messageType == MessageType::FATAL_ERROR) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
+ helper.Makefile->IssueMessage(
|
|
|
+ MessageType::FATAL_ERROR,
|
|
|
+ cmStrCat("The file\n ", file, '\n',
|
|
|
+ "was generated by the export() command. "
|
|
|
+ "It may not be installed with the install() command. "
|
|
|
+ "Use the install(EXPORT) mechanism instead. "
|
|
|
+ "See the cmake-packages(7) manual for more."));
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|
|
|
|