cmGeneratorTarget: Skip computing languages for custom targets
Targets created by `add_custom_target` do not compile any sources
and therefore have no languages.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index beafdea..554a954 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -7013,6 +7013,11 @@
void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages,
const std::string& config) const
{
+ // Targets that do not compile anything have no languages.
+ if (!this->CanCompileSources()) {
+ return;
+ }
+
std::vector<cmSourceFile*> sourceFiles;
this->GetSourceFiles(sourceFiles, config);
for (cmSourceFile* src : sourceFiles) {