diff --git a/Source/cmLocalUnixMakefileGenerator2.cxx b/Source/cmLocalUnixMakefileGenerator2.cxx index 400c3be5d..a8023e505 100644 --- a/Source/cmLocalUnixMakefileGenerator2.cxx +++ b/Source/cmLocalUnixMakefileGenerator2.cxx @@ -1605,6 +1605,14 @@ cmLocalUnixMakefileGenerator2 const char* linkLanguage = target.GetLinkerLanguage(this->GetGlobalGenerator()); + // Make sure we have a link language. + if(!linkLanguage) + { + cmSystemTools::Error("Cannot determine link language for target \"", + target.GetName(), "\"."); + return; + } + // Build a list of compiler flags and linker flags. std::string flags; std::string linkFlags;