summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-08-23 20:07:45 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-08-23 20:47:29 (GMT)
commit571b5e1f2c5569cd555377423930f8d61d5d2e99 (patch)
tree5f355f292c5707a8a2d1fb25937979e04083edd9 /Source
parent8b4d32c18b44db48115c1d214560335628b6acc0 (diff)
downloadCMake-571b5e1f2c5569cd555377423930f8d61d5d2e99.zip
CMake-571b5e1f2c5569cd555377423930f8d61d5d2e99.tar.gz
CMake-571b5e1f2c5569cd555377423930f8d61d5d2e99.tar.bz2
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.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorTarget.cxx31
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx4
-rw-r--r--Source/cmMakefileTargetGenerator.cxx6
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx6
5 files changed, 30 insertions, 21 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 357d0a6..43bcdd4 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -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;
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index b254777..c27466a 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -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"));
}
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index fd58f75..86163bf 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -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"));
}
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 5f27856..b94f7e9 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -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
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index b3699ae..e2b8e6b 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -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);