summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaNormalTargetGenerator.cxx
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2022-04-27 17:54:42 (GMT)
committerRobert Maynard <rmaynard@nvidia.com>2022-05-04 13:33:35 (GMT)
commit627ef4c1d002cf642ef0ef9048c5e3fa24069516 (patch)
tree810f7b1cd4c27b9e20fee545147b25192fcd3de9 /Source/cmNinjaNormalTargetGenerator.cxx
parent1d82670bd4daff26d0d0169820b289bc401f4943 (diff)
downloadCMake-627ef4c1d002cf642ef0ef9048c5e3fa24069516.zip
CMake-627ef4c1d002cf642ef0ef9048c5e3fa24069516.tar.gz
CMake-627ef4c1d002cf642ef0ef9048c5e3fa24069516.tar.bz2
Provide guidance when trying to use non-enabled language
Fixes #23463
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx10
1 files changed, 3 insertions, 7 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 1c5bac8..4f6da0e 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -126,15 +126,11 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules(
std::set<std::string> languages;
std::vector<cmSourceFile const*> sourceFiles;
this->GetGeneratorTarget()->GetObjectSources(sourceFiles, config);
- for (cmSourceFile const* sf : sourceFiles) {
- std::string const lang = sf->GetLanguage();
- if (!lang.empty()) {
- languages.insert(lang);
+ if (this->HaveRequiredLanguages(sourceFiles, languages)) {
+ for (std::string const& language : languages) {
+ this->WriteLanguageRules(language, config);
}
}
- for (std::string const& language : languages) {
- this->WriteLanguageRules(language, config);
- }
}
const char* cmNinjaNormalTargetGenerator::GetVisibleTypeName() const