cxxmodules: improve error messages for C++ module setup

Make it clear that:

- the quoted string is a target name; and
- C++ sources that export modules is the important detail.
This commit is contained in:
Ben Boeckel
2023-08-23 16:07:45 -04:00
parent 8b4d32c18b
commit 571b5e1f2c
9 changed files with 54 additions and 43 deletions
+20 -11
View File
@@ -8927,25 +8927,34 @@ void cmGeneratorTarget::CheckCxxModuleStatus(std::string const& config) const
case cmGeneratorTarget::Cxx20SupportLevel::MissingCxx:
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("The \"", this->GetName(),
"\" target has C++ module sources but the \"CXX\" language "
"has not been enabled"));
cmStrCat("The target named \"", this->GetName(),
"\" has C++ sources that export modules but the \"CXX\" "
"language has not been enabled"));
break;
case cmGeneratorTarget::Cxx20SupportLevel::MissingExperimentalFlag:
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("The \"", this->GetName(),
"\" target has C++ module sources but its experimental "
"support has not been requested"));
cmStrCat("The target named \"", this->GetName(),
"\" has C++ sources that export modules but its "
"experimental support has not been requested"));
break;
case cmGeneratorTarget::Cxx20SupportLevel::NoCxx20:
case cmGeneratorTarget::Cxx20SupportLevel::NoCxx20: {
cmStandardLevelResolver standardResolver(this->Makefile);
auto effStandard =
standardResolver.GetEffectiveStandard(this, "CXX", config);
if (effStandard.empty()) {
effStandard = "; no C++ standard found";
} else {
effStandard = cmStrCat("; found \"cxx_std_", effStandard, '"');
}
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat(
"The \"", this->GetName(),
"\" target has C++ module sources but is not using at least "
"\"cxx_std_20\""));
break;
"The target named \"", this->GetName(),
"\" has C++ sources that export modules but does not include "
"\"cxx_std_20\" (or newer) among its `target_compile_features`",
effStandard));
} break;
case cmGeneratorTarget::Cxx20SupportLevel::Supported:
// All is well.
break;
+2 -2
View File
@@ -438,8 +438,8 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
if (target->HaveCxx20ModuleSources() && !this->SupportsCxxModuleDyndep()) {
root->GetMakefile()->IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("The \"", target->GetName(),
"\" target contains C++ module sources which are not "
cmStrCat("The target named \"", target->GetName(),
"\" contains C++ sources that export modules which is not "
"supported by the generator"));
}
+2 -2
View File
@@ -1374,8 +1374,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget(
if (gtgt->HaveCxx20ModuleSources()) {
gtgt->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("The \"", gtgt->GetName(),
"\" target contains C++ module sources which are not "
cmStrCat("The target named \"", gtgt->GetName(),
"\" contains C++ sources that export modules which is not "
"supported by the generator"));
}
+3 -3
View File
@@ -201,9 +201,9 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
if (this->GeneratorTarget->HaveCxx20ModuleSources()) {
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("The \"", this->GeneratorTarget->GetName(),
"\" target contains C++ module sources which are not supported "
"by the generator"));
cmStrCat("The target named \"", this->GeneratorTarget->GetName(),
"\" contains C++ sources that export modules which is not "
"supported by the generator"));
}
// -- Write the custom commands for this target
+3 -3
View File
@@ -361,9 +361,9 @@ void cmVisualStudio10TargetGenerator::Generate()
!this->GlobalGenerator->SupportsCxxModuleDyndep()) {
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("The \"", this->GeneratorTarget->GetName(),
"\" target contains C++ module sources which are not supported "
"by the generator"));
cmStrCat("The target named \"", this->GeneratorTarget->GetName(),
"\" contains C++ sources that export modules which is not "
"supported by the generator"));
}
this->ProjectType = computeProjectType(this->GeneratorTarget);