Merge topic 'cxxmodules-non-compiled-source' into release-3.27

458e3974a8 cxxmodules: detect and message about non-compiled sources

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8773
This commit is contained in:
Brad King
2023-09-14 17:01:04 +00:00
committed by Kitware Robot
8 changed files with 61 additions and 4 deletions
+4 -3
View File
@@ -106,10 +106,11 @@ Json::Value CollationInformationCxxModules(
auto lookup = sf_map.find(file);
if (lookup == sf_map.end()) {
gt->Makefile->IssueMessage(
MessageType::INTERNAL_ERROR,
cmStrCat("Target \"", tgt->GetName(), "\" has source file \"",
MessageType::FATAL_ERROR,
cmStrCat("Target \"", tgt->GetName(), "\" has source file\n ",
file,
R"(" which is not in any of its "FILE_SET BASE_DIRS".)"));
"\nin a \"FILE_SET TYPE CXX_MODULES\" but it is not "
"scheduled for compilation."));
continue;
}
@@ -2540,6 +2540,12 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
break;
}
std::string config;
if (!this->Configurations.empty()) {
config = this->Configurations[si.Configs[0]];
}
auto const* fs =
this->GeneratorTarget->GetFileSetForSource(config, si.Source);
if (tool) {
// Compute set of configurations to exclude, if any.
std::vector<size_t> const& include_configs = si.Configs;
@@ -2604,6 +2610,13 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
if (si.Kind == cmGeneratorTarget::SourceKindObjectSource ||
si.Kind == cmGeneratorTarget::SourceKindUnityBatched) {
this->OutputSourceSpecificFlags(e2, si.Source);
} else if (fs && fs->GetType() == "CXX_MODULES"_s) {
this->GeneratorTarget->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("Target \"", this->GeneratorTarget->GetName(),
"\" has source file\n ", si.Source->GetFullPath(),
"\nin a \"FILE_SET TYPE CXX_MODULES\" but it is not "
"scheduled for compilation."));
}
if (si.Source->GetPropertyAsBool("SKIP_PRECOMPILE_HEADERS")) {
e2.Element("PrecompiledHeader", "NotUsing");
@@ -2613,6 +2626,13 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
}
this->FinishWritingSource(e2, toolSettings);
} else if (fs && fs->GetType() == "CXX_MODULES"_s) {
this->GeneratorTarget->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("Target \"", this->GeneratorTarget->GetName(),
"\" has source file\n ", si.Source->GetFullPath(),
"\nin a \"FILE_SET TYPE CXX_MODULES\" but it is not "
"scheduled for compilation."));
}
}