summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-08-25 15:27:10 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-08-25 15:27:27 (GMT)
commit863891adb232cd89830080c702361444f496b4fe (patch)
tree4a7c0cb3b7a33d3cf2cfe85f0d5075f7455605ae /Source/cmGeneratorTarget.cxx
parent5ae0030e90df07e56dc16b0210bd334650dcc9d4 (diff)
parent571b5e1f2c5569cd555377423930f8d61d5d2e99 (diff)
downloadCMake-863891adb232cd89830080c702361444f496b4fe.zip
CMake-863891adb232cd89830080c702361444f496b4fe.tar.gz
CMake-863891adb232cd89830080c702361444f496b4fe.tar.bz2
Merge topic 'modules-better-messages'
571b5e1f2c cxxmodules: improve error messages for C++ module setup 8b4d32c18b cmStandardLevelResolver: add query for the effective standard level 17ddc4ac76 cmStandardLevelResolver: compare with static string literals 6f1dae2b01 cmStandardLevelResolver: use `cmStrCat` where possible 0d45d40e13 cmStandardLevelResolver: use character literals where possible Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !8755
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx31
1 files changed, 20 insertions, 11 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 70f51b0..db4be63 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -9100,25 +9100,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;