summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-09-28 20:08:06 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-10-02 14:17:31 (GMT)
commit3cddd116495a85ce86e1149c05ce9a2a701e0c8b (patch)
tree1d15042fb2f4c21f8f7455f7e3d4dfb7353b8fed /Source
parent068fde1c348459ca41cdd6c21d782ba1491746c4 (diff)
downloadCMake-3cddd116495a85ce86e1149c05ce9a2a701e0c8b.zip
CMake-3cddd116495a85ce86e1149c05ce9a2a701e0c8b.tar.gz
CMake-3cddd116495a85ce86e1149c05ce9a2a701e0c8b.tar.bz2
Ninja: message about not compiled sources explicitly
With CMP0155, filesets with only non-compiled sources do not go through the collation path that detects it. Detect it explicitly like the Visual Studio generator does.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 5d4397b..0bda945 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1143,6 +1143,30 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
}
}
+ // Detect sources in `CXX_MODULES` which are not compiled.
+ {
+ std::vector<cmSourceFile*> sources;
+ this->GeneratorTarget->GetSourceFiles(sources, config);
+ for (cmSourceFile const* sf : sources) {
+ cmFileSet const* fs =
+ this->GeneratorTarget->GetFileSetForSource(config, sf);
+ if (!fs) {
+ continue;
+ }
+ if (fs->GetType() != "CXX_MODULES"_s) {
+ continue;
+ }
+ if (sf->GetLanguage().empty()) {
+ this->GeneratorTarget->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Target \"", this->GeneratorTarget->GetName(),
+ "\" has source file\n ", sf->GetFullPath(),
+ "\nin a \"FILE_SET TYPE CXX_MODULES\" but it is not "
+ "scheduled for compilation."));
+ }
+ }
+ }
+
for (auto const& langScanningFiles : this->Configs[config].ScanningInfo) {
std::string const& language = langScanningFiles.first;
std::vector<ScanningFiles> const& scanningFiles = langScanningFiles.second;