diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index beafdeac46..554a954ff4 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -7013,6 +7013,11 @@ std::string cmGeneratorTarget::GetDeprecation() const void cmGeneratorTarget::GetLanguages(std::set& languages, const std::string& config) const { + // Targets that do not compile anything have no languages. + if (!this->CanCompileSources()) { + return; + } + std::vector sourceFiles; this->GetSourceFiles(sourceFiles, config); for (cmSourceFile* src : sourceFiles) {